This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Create slices #21
Open
johnmarkredding
wants to merge
9
commits into
vicb:master
Choose a base branch
from
johnmarkredding:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create slices #21
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2797323
standardize formatting according to linter
johnmarkredding 5d5f957
Include .tsx files in Swc processing
johnmarkredding e400063
Remove .rollup.cache on build
johnmarkredding a575a0d
Merge pull request #2 from johnmarkredding/create-store-rtk
johnmarkredding 10db459
Update config
johnmarkredding ff45b36
Add style consistency
johnmarkredding 5a52906
Create typed dispatch and selector hooks
johnmarkredding dc63ba5
Create slices
johnmarkredding 9285a49
Merge pull request #3 from johnmarkredding/convert-to-slices
johnmarkredding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,203 +1,208 @@ | ||
const jsRules = { | ||
indent: 'off', | ||
'no-fallthrough': ['warn', { commentPattern: 'break[\\s\\w]*omitted' }], | ||
'no-cond-assign': 'off', | ||
'no-console': 'off', | ||
'no-irregular-whitespace': 'off', | ||
'no-prototype-builtins': 'off', | ||
'no-mixed-spaces-and-tabs': 'error', | ||
'no-const-assign': 'error', | ||
'no-undef-init': 'error', | ||
'no-undef': 'error', | ||
curly: 'error', | ||
'no-var': 'error', | ||
'prefer-const': 'error', | ||
'no-tabs': 'error', | ||
'no-use-before-define': ['error', { functions: false }], // function declarations are hoisted, so it's safe | ||
'one-var': ['error', { const: 'never' }], | ||
'import/no-duplicates': 'error', | ||
'no-empty': 'error', | ||
'no-redeclare': 'error', | ||
'prefer-rest-params': 'off', | ||
'prefer-spread': 'off', | ||
'no-import-assign': 'warn', | ||
'a11y-no-static-element-interactions': 'off', | ||
'a11y-missing-attribute': 'off', | ||
"react/react-in-jsx-scope": "off", | ||
indent: "off", | ||
"no-fallthrough": ["warn", { commentPattern: "break[\\s\\w]*omitted" }], | ||
"no-cond-assign": "off", | ||
"no-console": "off", | ||
"no-irregular-whitespace": "off", | ||
"no-prototype-builtins": "off", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-const-assign": "error", | ||
"no-undef-init": "error", | ||
"no-undef": "error", | ||
curly: "error", | ||
"no-var": "error", | ||
"prefer-const": "error", | ||
"no-tabs": "error", | ||
"no-use-before-define": ["error", { functions: false }], // function declarations are hoisted, so it's safe | ||
"one-var": ["error", { const: "never" }], | ||
"import/no-duplicates": "error", | ||
"no-empty": "error", | ||
"no-redeclare": "error", | ||
"prefer-rest-params": "off", | ||
"prefer-spread": "off", | ||
"no-import-assign": "warn", | ||
"a11y-no-static-element-interactions": "off", | ||
"a11y-missing-attribute": "off", | ||
}; | ||
|
||
const tsRules = { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/array-type': [ | ||
'error', | ||
{ | ||
default: 'array', | ||
readonly: 'generic', | ||
}, | ||
], | ||
'no-fallthrough': ['warn', { commentPattern: 'break[\\s\\w]*omitted' }], | ||
'@typescript-eslint/ban-types': [ | ||
'error', | ||
{ | ||
types: { | ||
Boolean: 'Avoid using the `Boolean` type. Did you mean `boolean`?', | ||
Function: | ||
'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.', | ||
Number: 'Avoid using the `Number` type. Did you mean `number`?', | ||
Object: 'Avoid using the `Object` type. Did you mean `object`?', | ||
String: 'Avoid using the `String` type. Did you mean `string`?', | ||
Symbol: 'Avoid using the `Symbol` type. Did you mean `symbol`?', | ||
}, | ||
}, | ||
], | ||
'@typescript-eslint/explicit-member-accessibility': 'off', | ||
'@typescript-eslint/member-ordering': [ | ||
'error', | ||
{ | ||
default: [ | ||
'private-static-field', | ||
'public-static-field', | ||
'private-instance-field', | ||
'public-instance-field', | ||
'private-constructor', | ||
'public-constructor', | ||
'public-instance-method', | ||
'protected-instance-method', | ||
'private-instance-method', | ||
], | ||
}, | ||
], | ||
'@typescript-eslint/type-annotation-spacing': 'error', | ||
'@typescript-eslint/unified-signatures': 'error', | ||
'@typescript-eslint/await-thenable': 'error', | ||
'@typescript-eslint/promise-function-async': 'off', // it should be error, but we transpiling to ES5, so we need promises instead of async/await | ||
'@typescript-eslint/no-var-requires': 'error', | ||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], | ||
'@typescript-eslint/no-this-alias': 'off', | ||
'@typescript-eslint/member-delimiter-style': [ | ||
'error', | ||
{ | ||
multiline: { delimiter: 'semi', requireLast: true }, | ||
singleline: { delimiter: 'semi', requireLast: false }, | ||
}, | ||
], | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/no-misused-new': 'error', | ||
'@typescript-eslint/semi': ['error', 'always'], | ||
'@typescript-eslint/no-shadow': ['error', { hoist: 'all' }], | ||
'@typescript-eslint/no-inferrable-types': 'off', | ||
'no-undef': 'off', // TS handles no-undef on its own, this JS rule is buggy for TS files | ||
'no-use-before-define': 'off', // TS handles this rule with '@typescript-eslint/no-use-before-define' | ||
'no-redeclare': 'off', // TS handles this rule with '@typescript-eslint/no-redeclare' | ||
'@typescript-eslint/no-redeclare': 'error', | ||
'@typescript-eslint/no-use-before-define': ['error', { functions: false }], | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/array-type": [ | ||
"error", | ||
{ | ||
default: "array", | ||
readonly: "generic", | ||
}, | ||
], | ||
"@typescript-eslint/ban-types": [ | ||
"error", | ||
{ | ||
types: { | ||
Boolean: "Avoid using the `Boolean` type. Did you mean `boolean`?", | ||
Function: | ||
"Avoid using the `Function` type. Prefer a specific function type, like `() => void`.", | ||
Number: "Avoid using the `Number` type. Did you mean `number`?", | ||
Object: "Avoid using the `Object` type. Did you mean `object`?", | ||
String: "Avoid using the `String` type. Did you mean `string`?", | ||
Symbol: "Avoid using the `Symbol` type. Did you mean `symbol`?", | ||
}, | ||
}, | ||
], | ||
"@typescript-eslint/explicit-member-accessibility": "off", | ||
"@typescript-eslint/member-ordering": [ | ||
"error", | ||
{ | ||
default: [ | ||
"private-static-field", | ||
"public-static-field", | ||
"private-instance-field", | ||
"public-instance-field", | ||
"private-constructor", | ||
"public-constructor", | ||
"public-instance-method", | ||
"protected-instance-method", | ||
"private-instance-method", | ||
], | ||
}, | ||
], | ||
"@typescript-eslint/type-annotation-spacing": "error", | ||
"@typescript-eslint/unified-signatures": "error", | ||
"@typescript-eslint/await-thenable": "error", | ||
"@typescript-eslint/promise-function-async": "off", // it should be error, but we transpiling to ES5, so we need promises instead of async/await | ||
"@typescript-eslint/no-var-requires": "error", | ||
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }], | ||
"@typescript-eslint/no-this-alias": "off", | ||
"@typescript-eslint/member-delimiter-style": [ | ||
"error", | ||
{ | ||
multiline: { delimiter: "semi", requireLast: true }, | ||
singleline: { delimiter: "semi", requireLast: false }, | ||
}, | ||
], | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/no-misused-new": "error", | ||
"@typescript-eslint/semi": ["error", "always"], | ||
"@typescript-eslint/no-shadow": ["error", { hoist: "all" }], | ||
"@typescript-eslint/no-inferrable-types": "off", | ||
"no-undef": "off", // TS handles no-undef on its own, this JS rule is buggy for TS files | ||
"no-use-before-define": "off", // TS handles this rule with '@typescript-eslint/no-use-before-define' | ||
"no-redeclare": "off", // TS handles this rule with '@typescript-eslint/no-redeclare' | ||
"@typescript-eslint/no-redeclare": "error", | ||
"@typescript-eslint/no-use-before-define": ["error", { functions: false }], | ||
"react/prop-types": "off", | ||
}; | ||
|
||
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md | ||
const importOrder = { | ||
'import/order': [ | ||
'warn', | ||
{ | ||
groups: [['builtin', 'internal', 'external'], ['parent', 'sibling', 'index'], 'type'], | ||
"import/order": [ | ||
"warn", | ||
{ | ||
groups: [ | ||
["builtin", "internal", "external"], | ||
["parent", "sibling", "index"], | ||
"type", | ||
], | ||
|
||
// NOTE: Using @windy/**, @capacitor/** pattern collides, with 'type' group | ||
pathGroups: [ | ||
{ | ||
pattern: 'svelte', | ||
group: 'type', | ||
position: 'before', | ||
}, | ||
], | ||
// NOTE: Using @windy/**, @capacitor/** pattern collides, with 'type' group | ||
pathGroups: [ | ||
{ | ||
pattern: "svelte", | ||
group: "type", | ||
position: "before", | ||
}, | ||
], | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
node: true, | ||
browser: true, | ||
jest: true, | ||
}, | ||
parserOptions: { | ||
root: true, | ||
env: { | ||
es6: true, | ||
node: true, | ||
browser: true, | ||
jest: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2022, | ||
sourceType: "module", | ||
jsx: true, | ||
}, | ||
globals: { | ||
L: true, | ||
W: true, | ||
console: true, | ||
}, | ||
plugins: ["import"], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/typescript", | ||
], | ||
overrides: [ | ||
{ | ||
files: ["**/*.svelte"], | ||
// WARN import plugin could be an issue in a combination with svelte | ||
// https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/OTHER_PLUGINS.md | ||
plugins: ["@typescript-eslint", "import"], | ||
parser: "svelte-eslint-parser", | ||
parserOptions: { | ||
parser: "@typescript-eslint/parser", | ||
// Use separate tsconfig to make linting faster | ||
project: "./tsconfig.eslint.json", | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
jsx: true, | ||
}, | ||
globals: { | ||
L: true, | ||
W: true, | ||
console: true, | ||
}, | ||
plugins: ['import'], | ||
extends: [ | ||
'eslint:recommended', | ||
tsconfigRootDir: __dirname, | ||
sourceType: "module", | ||
extraFileExtensions: [".svelte"], | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:import/typescript', | ||
], | ||
overrides: [ | ||
{ | ||
files: ['**/*.svelte'], | ||
// WARN import plugin could be an issue in a combination with svelte | ||
// https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/OTHER_PLUGINS.md | ||
plugins: ['@typescript-eslint', 'import'], | ||
parser: 'svelte-eslint-parser', | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
// Use separate tsconfig to make linting faster | ||
project: './tsconfig.eslint.json', | ||
ecmaVersion: 2022, | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
extraFileExtensions: ['.svelte'], | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
"plugin:react/recommended", | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:import/typescript', | ||
], | ||
rules: { | ||
...jsRules, | ||
...tsRules, | ||
...importOrder, | ||
'no-undef-init': 'off', | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'no-inner-declarations': 'off', | ||
'no-self-assign': 'off', | ||
}, | ||
settings: { | ||
'svelte/ignore-styles': () => true, | ||
'svelte/ignore-warnings': w => w.code.startsWith('a11y-'), | ||
'svelte/typescript': require('typescript'), | ||
}, | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/typescript", | ||
], | ||
rules: { | ||
...jsRules, | ||
...tsRules, | ||
...importOrder, | ||
"no-undef-init": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"no-inner-declarations": "off", | ||
"no-self-assign": "off", | ||
}, | ||
settings: { | ||
"svelte/ignore-styles": () => true, | ||
"svelte/ignore-warnings": (w) => w.code.startsWith("a11y-"), | ||
"svelte/typescript": require("typescript"), | ||
}, | ||
}, | ||
{ | ||
files: ["**/*.ts", "**/*.tsx"], | ||
plugins: ["@typescript-eslint", "import"], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/typescript", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: "./tsconfig.json", | ||
ecmaVersion: 2022, | ||
sourceType: "module", | ||
}, | ||
rules: { ...jsRules, ...tsRules, ...importOrder }, | ||
settings: { | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts"], | ||
}, | ||
{ | ||
files: ['**/*.ts'], | ||
plugins: ['@typescript-eslint', 'import'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:import/typescript', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
}, | ||
rules: { ...jsRules, ...tsRules, ...importOrder }, | ||
settings: { | ||
'import/parsers': { | ||
'@typescript-eslint/parser': ['.ts'], | ||
}, | ||
'import/resolver': { | ||
'eslint-import-resolver-typescript': true, | ||
}, | ||
}, | ||
"import/resolver": { | ||
"eslint-import-resolver-typescript": true, | ||
}, | ||
], | ||
rules: jsRules, | ||
ignorePatterns: ['dist/**', 'node_modules/**'], | ||
}, | ||
}, | ||
], | ||
rules: jsRules, | ||
ignorePatterns: ["dist/**", "node_modules/**"], | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consider adding a comment explaining why this rule is turned off.
Disabling the 'react/react-in-jsx-scope' rule can be confusing for future developers. Adding a comment explaining the rationale behind this decision would be helpful.