@mscharley/eslint-config 3.1.4 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # Change Log - @mscharley/eslint-config
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 1720d57: Migrate ESLint to flat configurations.
8
+
9
+ BREAKING CHANGE: it will require migration work to update to this version. The migration to the new flat configuration format is fairly straightforward. The new rulesets are exported as `import('@mscharley/eslint-config').configs`. There is also a `withStyles()` function for enabling style linting for a project which was enabled by default previously. This doesn't currently take any options but may in the future to allow certain style parameters to be tweaked.
10
+
11
+ BREAKING CHANGE: Officially drop node 16 support.
12
+
13
+ ### Patch Changes
14
+
15
+ - 8c70c28: fix(deps): update dependency eslint-plugin-react to ^7.36.0
16
+ - 8f4d995: fix(deps): update dependency eslint-plugin-react to ^7.36.1
17
+ - 31a13e3: fix(deps): update dependency eslint to ^8.57.1
18
+ - 99b0098: fix(deps): update dependency eslint-plugin-react to ^7.37.0
19
+ - 1f13a80: fix(deps): update dependency eslint-plugin-react to ^7.37.1
20
+ - abf5881: fix(deps): update dependency eslint-plugin-import to ^2.31.0
21
+ - 2ed1dfc: fix(deps): update eslint packages
22
+
23
+ ## 3.1.5
24
+
25
+ ### Patch Changes
26
+
27
+ - 64016d4: fix(deps): update typescript-eslint monorepo to ^7.9.0
28
+ - 08f4b1c: fix(deps): update typescript-eslint monorepo to ^7.10.0
29
+ - e092de8: fix(deps): update dependency eslint-plugin-react to ^7.34.2
30
+ - b718913: fix(deps): update typescript-eslint monorepo to ^7.11.0
31
+ - 7fa333b: fix(deps): update typescript-eslint monorepo to ^7.12.0
32
+ - 04544dc: fix(deps): update typescript-eslint monorepo to ^7.13.0
33
+ - a82107a: fix(deps): update dependency eslint-plugin-react to ^7.34.3
34
+ - 001ead1: fix(deps): update typescript-eslint monorepo to ^7.13.1
35
+ - 82c7dd3: fix(deps): update dependency typescript to v5.5.2
36
+ - 4831062: fix(deps): update typescript-eslint monorepo to ^7.14.1
37
+ - 9695744: fix(deps): update dependency typescript to v5.5.3
38
+ - e5c3af3: fix(deps): update typescript-eslint monorepo to ^7.15.0
39
+ - 3e0d059: fix(deps): update typescript-eslint monorepo to ^7.16.0
40
+ - 83a04ff: fix(deps): update dependency eslint-plugin-react to ^7.34.4
41
+ - 40611b6: fix(deps): update typescript-eslint monorepo to ^7.16.1
42
+ - 7506cb7: fix(deps): update dependency typescript to v5.5.4
43
+ - 496d3d2: fix(deps): update dependency eslint-plugin-react to ^7.35.0
44
+ - 66fc1a0: fix(deps): update typescript-eslint monorepo to ^7.17.0
45
+ - 798e9a6: fix(deps): update typescript-eslint monorepo to ^7.18.0
46
+ - 272c7bb: fix(deps): update dependency eslint-import-resolver-typescript to ^3.6.3
47
+ - 826b5be: fix(deps): update eslint packages
48
+ - d31f77b: fix(deps): update dependency typescript to v5.6.2
49
+
3
50
  ## 3.1.4
4
51
 
5
52
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "@mscharley/eslint-config",
3
- "version": "3.1.4",
3
+ "version": "4.0.0",
4
+ "type": "module",
5
+ "module": "./rules/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./rules/index.js"
9
+ }
10
+ },
4
11
  "publishConfig": {
5
12
  "provenance": true
6
13
  },
@@ -27,17 +34,16 @@
27
34
  },
28
35
  "homepage": "https://github.com/mscharley/node-presets#readme",
29
36
  "peerDependencies": {
30
- "@stylistic/eslint-plugin": "^1.8.1",
31
- "@typescript-eslint/eslint-plugin": "^7.8.0",
32
- "@typescript-eslint/parser": "^7.8.0",
33
- "eslint": "^8.57.0",
34
- "eslint-import-resolver-typescript": "^3.6.1",
35
- "eslint-plugin-deprecation": "^2.0.0",
36
- "eslint-plugin-import": "^2.29.1",
37
- "eslint-plugin-jest": "^27.9.0",
38
- "eslint-plugin-n": "^16.6.2",
39
- "eslint-plugin-react": "^7.34.1",
40
- "eslint-plugin-react-hooks": "^4.6.2",
41
- "typescript": "^5.4.5"
37
+ "@stylistic/eslint-plugin": "^2.9.0",
38
+ "@types/eslint": "^9.6.1",
39
+ "eslint": "^9.12.0",
40
+ "eslint-import-resolver-typescript": "^3.6.3",
41
+ "eslint-plugin-import": "^2.31.0",
42
+ "eslint-plugin-jest": "^28.8.3",
43
+ "eslint-plugin-n": "^17.10.3",
44
+ "eslint-plugin-react": "^7.37.1",
45
+ "eslint-plugin-react-hooks": "5.1.0-beta-26f2496093-20240514",
46
+ "typescript": "^5.6.2",
47
+ "typescript-eslint": "^8.8.0"
42
48
  }
43
49
  }
@@ -0,0 +1,113 @@
1
+ import importPlugin from 'eslint-plugin-import';
2
+ import js from '@eslint/js';
3
+
4
+ /** @type import('eslint').Config[] */
5
+ export default [
6
+ js.configs.recommended,
7
+ importPlugin.flatConfigs.recommended,
8
+ importPlugin.flatConfigs.typescript,
9
+ {
10
+ // parser: 'espree',
11
+ rules: {
12
+ 'import/first': ['warn'],
13
+ 'import/no-cycle': ['error', { ignoreExternal: true }],
14
+ 'import/no-duplicates': 'error',
15
+ 'import/no-useless-path-segments': ['warn'],
16
+ 'array-callback-return': 'error',
17
+ 'block-scoped-var': 'warn',
18
+ 'complexity': ['warn', { max: 20 }],
19
+ 'consistent-return': 'error',
20
+ 'curly': ['error', 'all'],
21
+ 'default-case': 'error',
22
+ 'default-param-last': 'error',
23
+ 'dot-notation': 'warn',
24
+ 'eqeqeq': ['error', 'always', { null: 'ignore' }],
25
+ 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
26
+ 'guard-for-in': 'warn',
27
+ 'no-alert': 'warn',
28
+ 'no-await-in-loop': 'error',
29
+ 'no-buffer-constructor': 'error',
30
+ 'no-console': 'warn',
31
+ 'no-duplicate-imports': 'off',
32
+ 'no-eval': 'error',
33
+ 'no-extend-native': 'error',
34
+ 'no-extra-bind': 'error',
35
+ 'no-fallthrough': 'error',
36
+ 'no-global-assign': 'error',
37
+ 'no-implicit-coercion': 'error',
38
+ 'no-implied-eval': 'error',
39
+ 'no-iterator': 'error',
40
+ 'no-lone-blocks': 'warn',
41
+ 'no-lonely-if': 'error',
42
+ 'no-loop-func': 'error',
43
+ 'no-magic-numbers': [
44
+ 'warn',
45
+ {
46
+ enforceConst: false,
47
+ ignore: [0, 1],
48
+ ignoreArrayIndexes: true,
49
+ },
50
+ ],
51
+ 'no-multi-str': 'error',
52
+ 'no-new': 'error',
53
+ 'no-new-func': 'error',
54
+ 'no-octal': 'error',
55
+ 'no-octal-escape': 'error',
56
+ 'no-param-reassign': 'error',
57
+ 'no-process-exit': 'off',
58
+ 'no-proto': 'error',
59
+ 'no-prototype-builtins': 'warn',
60
+ 'no-restricted-syntax': [
61
+ 'error',
62
+ {
63
+ selector: 'SequenceExpression',
64
+ message: 'The comma operator is confusing and a common mistake. Don’t use it!',
65
+ },
66
+ ],
67
+ 'no-return-assign': ['error', 'always'],
68
+ 'no-return-await': 'error',
69
+ 'no-self-compare': 'error',
70
+ 'no-shadow': 'error',
71
+ 'no-sync': 'error',
72
+ 'no-template-curly-in-string': 'warn',
73
+ 'no-throw-literal': 'error',
74
+ 'no-unexpected-multiline': 'error',
75
+ 'no-unused-vars': [
76
+ 'warn',
77
+ {
78
+ argsIgnorePattern: '^_',
79
+ varsIgnorePattern: '^_',
80
+ },
81
+ ],
82
+ 'no-use-before-define': 'error',
83
+ 'no-useless-call': 'error',
84
+ 'no-useless-computed-key': 'error',
85
+ 'no-useless-concat': 'warn',
86
+ 'no-useless-constructor': 'error',
87
+ 'no-useless-rename': 'error',
88
+ 'no-useless-return': 'error',
89
+ 'no-var': 'error',
90
+ 'no-void': ['error', { allowAsStatement: true }],
91
+ 'no-warning-comments': 'warn',
92
+ 'prefer-arrow-callback': 'error',
93
+ 'prefer-const': 'error',
94
+ 'prefer-numeric-literals': 'error',
95
+ 'prefer-promise-reject-errors': 'error',
96
+ 'prefer-regex-literals': 'error',
97
+ 'prefer-rest-params': 'error',
98
+ 'prefer-spread': 'error',
99
+ 'prefer-template': 'error',
100
+ 'require-atomic-updates': 'warn',
101
+ 'require-await': 'error',
102
+ 'require-unicode-regexp': 'warn',
103
+ 'sort-imports': ['warn', { allowSeparatedGroups: true, ignoreCase: true }],
104
+ 'symbol-description': 'error',
105
+ },
106
+ settings: {
107
+ 'import/resolver': {
108
+ typescript: true,
109
+ node: true,
110
+ },
111
+ },
112
+ },
113
+ ];
package/rules/index.js ADDED
@@ -0,0 +1,40 @@
1
+ import eslint from './eslint.js';
2
+ import node from './node.js';
3
+ import react from './react.js';
4
+ import stylistic from '@stylistic/eslint-plugin';
5
+ import testing from './testing.js';
6
+ import typescript from './typescript.js';
7
+
8
+ export const configs = {
9
+ recommended: [
10
+ { linterOptions: { reportUnusedDisableDirectives: true } },
11
+ ...eslint,
12
+ ...typescript,
13
+ ...testing,
14
+ ],
15
+ node,
16
+ react,
17
+ };
18
+
19
+ export const withStyles = () => [
20
+ stylistic.configs['disable-legacy'],
21
+ stylistic.configs.customize({
22
+ indent: 'tab',
23
+ quotes: 'single',
24
+ semi: true,
25
+ jsx: true,
26
+ commaDangle: 'always-multiline',
27
+ quoteProps: 'always',
28
+ arrowParens: true,
29
+ braceStyle: '1tbs',
30
+ }),
31
+ {
32
+ rules: {
33
+ '@stylistic/generator-star-spacing': ['error', 'after'],
34
+ '@stylistic/linebreak-style': ['error', 'unix'],
35
+ '@stylistic/quote-props': ['error', 'consistent-as-needed'],
36
+ },
37
+ },
38
+ ];
39
+
40
+ export default { configs, withStyles };
package/rules/node.js ADDED
@@ -0,0 +1,25 @@
1
+ import n from 'eslint-plugin-n';
2
+
3
+ export default [
4
+ n.configs['flat/recommended'],
5
+ {
6
+ settings: {
7
+ node: {
8
+ tryExtensions: ['.js', '.jsx', '.mjs', '.cjs', '.json', '.node', '.d.ts', '.ts', '.tsx', '.mts', '.cts'],
9
+ },
10
+ },
11
+ rules: {
12
+ 'n/no-sync': 'warn',
13
+ 'n/no-missing-import': 'off',
14
+ 'n/no-missing-require': 'off',
15
+ 'n/prefer-promises/dns': 'warn',
16
+ 'n/prefer-promises/fs': 'warn',
17
+ },
18
+ },
19
+ {
20
+ files: ['**/*.ts', '**/*.tsx'],
21
+ rules: {
22
+ 'n/no-unsupported-features/es-syntax': 'off',
23
+ },
24
+ },
25
+ ];
package/rules/react.js ADDED
@@ -0,0 +1,14 @@
1
+ import react from 'eslint-plugin-react';
2
+ import reactHooks from 'eslint-plugin-react-hooks';
3
+
4
+ export default [
5
+ react.configs.flat.recommended,
6
+ react.configs.flat['jsx-runtime'],
7
+ reactHooks.configs.recommended,
8
+ {
9
+ rules: {
10
+ 'react/prefer-stateless-function': 'error',
11
+ 'react/prop-types': 'off',
12
+ },
13
+ },
14
+ ];
@@ -0,0 +1,38 @@
1
+ import jest from 'eslint-plugin-jest';
2
+
3
+ const jestFiles = [
4
+ '**/__tests__/**/*.{ts,js,tsx,jsx}',
5
+ '**/__mocks__/**/*.{ts,js,tsx,jsx}',
6
+ '**/__utils__/**/*.{ts,js,tsx,jsx}',
7
+ ];
8
+
9
+ export default [
10
+ {
11
+ // Viteshot support.
12
+ files: ['**/*.screenshot.{jsx,tsx}'],
13
+ rules: {
14
+ '@typescript-eslint/explicit-function-return-type': 'off',
15
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
16
+ },
17
+ },
18
+ // Jest support.
19
+ { files: jestFiles, ...jest.configs['flat/style'] },
20
+ { files: jestFiles, ...jest.configs['flat/recommended'] },
21
+ {
22
+ files: jestFiles,
23
+ rules: {
24
+ '@typescript-eslint/consistent-type-assertions': 'off',
25
+ 'jest/prefer-todo': 'error',
26
+ 'jest/no-conditional-in-test': 'warn',
27
+ 'jest/no-untyped-mock-factory': 'error',
28
+ 'jest/prefer-called-with': 'error',
29
+ 'jest/prefer-comparison-matcher': 'warn',
30
+ 'jest/prefer-equality-matcher': 'warn',
31
+ 'jest/prefer-lowercase-title': 'error',
32
+ 'jest/prefer-expect-assertions': [
33
+ 'error',
34
+ { onlyFunctionsWithExpectInLoop: true, onlyFunctionsWithExpectInCallback: true },
35
+ ],
36
+ },
37
+ },
38
+ ];
@@ -0,0 +1,175 @@
1
+ import { configs as tseslint } from 'typescript-eslint';
2
+
3
+ /** @type import('eslint').Config[] */
4
+ export default [
5
+ ...tseslint.recommendedTypeChecked,
6
+ {
7
+ files: [
8
+ '**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts',
9
+ ],
10
+ languageOptions: {
11
+ parserOptions: {
12
+ projectService: true,
13
+ },
14
+ },
15
+ rules: {
16
+ '@typescript-eslint/no-deprecated': 'warn',
17
+ '@typescript-eslint/array-type': [
18
+ 'error',
19
+ {
20
+ default: 'array-simple',
21
+ readonly: 'generic',
22
+ },
23
+ ],
24
+ '@typescript-eslint/class-literal-property-style': ['error', 'fields'],
25
+ '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
26
+ '@typescript-eslint/consistent-type-assertions': [
27
+ 'warn',
28
+ {
29
+ assertionStyle: 'as',
30
+ objectLiteralTypeAssertions: 'allow-as-parameter',
31
+ },
32
+ ],
33
+ '@typescript-eslint/consistent-type-imports': [
34
+ 'warn',
35
+ { prefer: 'type-imports', disallowTypeAnnotations: true },
36
+ ],
37
+ '@typescript-eslint/explicit-function-return-type': [
38
+ 'warn',
39
+ {
40
+ allowConciseArrowFunctionExpressionsStartingWithVoid: true,
41
+ allowDirectConstAssertionInArrowFunctions: false,
42
+ allowExpressions: false,
43
+ allowHigherOrderFunctions: true,
44
+ allowTypedFunctionExpressions: true,
45
+ },
46
+ ],
47
+ 'default-param-last': 'off',
48
+ '@typescript-eslint/default-param-last': 'error',
49
+ '@typescript-eslint/explicit-member-accessibility': 'error',
50
+ '@typescript-eslint/explicit-module-boundary-types': [
51
+ 'error',
52
+ {
53
+ allowArgumentsExplicitlyTypedAsAny: false,
54
+ allowDirectConstAssertionInArrowFunctions: false,
55
+ allowedNames: [],
56
+ allowHigherOrderFunctions: true,
57
+ allowTypedFunctionExpressions: true,
58
+ },
59
+ ],
60
+ '@typescript-eslint/indent': 'off',
61
+ // '@typescript-eslint/member-delimiter-style': 'error',
62
+ '@typescript-eslint/method-signature-style': ['error', 'property'],
63
+ '@typescript-eslint/no-explicit-any': 'error',
64
+ '@typescript-eslint/no-invalid-void-type': 'warn',
65
+ 'no-magic-numbers': 'off',
66
+ 'no-loop-func': 'off',
67
+ '@typescript-eslint/no-loop-func': 'error',
68
+ '@typescript-eslint/no-magic-numbers': [
69
+ 'warn',
70
+ {
71
+ enforceConst: false,
72
+ ignore: [0, 1],
73
+ ignoreArrayIndexes: true,
74
+ ignoreEnums: true,
75
+ ignoreNumericLiteralTypes: true,
76
+ },
77
+ ],
78
+ '@typescript-eslint/no-misused-new': 'error',
79
+ '@typescript-eslint/no-non-null-assertion': 'error',
80
+ 'no-shadow': 'off',
81
+ '@typescript-eslint/no-shadow': 'error',
82
+ '@typescript-eslint/no-type-alias': [
83
+ 'error',
84
+ {
85
+ allowAliases: 'in-unions-and-intersections',
86
+ allowLiterals: 'in-unions-and-intersections',
87
+ allowCallbacks: 'always',
88
+ allowConditionalTypes: 'always',
89
+ allowConstructors: 'always',
90
+ allowMappedTypes: 'always',
91
+ allowTupleTypes: 'always',
92
+ },
93
+ ],
94
+ 'no-use-before-define': 'off',
95
+ '@typescript-eslint/no-use-before-define': 'error',
96
+ 'no-useless-constructor': 'off',
97
+ '@typescript-eslint/no-useless-constructor': 'error',
98
+ '@typescript-eslint/prefer-for-of': 'error',
99
+ '@typescript-eslint/prefer-function-type': 'error',
100
+ '@typescript-eslint/unified-signatures': 'warn',
101
+ '@typescript-eslint/await-thenable': 'error',
102
+ '@typescript-eslint/ban-ts-comment': [
103
+ 'error',
104
+ {
105
+ 'ts-expect-error': 'allow-with-description',
106
+ 'ts-ignore': false,
107
+ 'ts-nocheck': false,
108
+ 'ts-check': true,
109
+ },
110
+ ],
111
+ 'dot-notation': 'off',
112
+ '@typescript-eslint/dot-notation': 'warn',
113
+ '@typescript-eslint/no-base-to-string': 'error',
114
+ '@typescript-eslint/no-floating-promises': [
115
+ 'error',
116
+ {
117
+ ignoreVoid: true,
118
+ ignoreIIFE: false,
119
+ },
120
+ ],
121
+ 'no-implied-eval': 'off',
122
+ '@typescript-eslint/no-implied-eval': 'error',
123
+ '@typescript-eslint/no-misused-promises': 'error',
124
+ '@typescript-eslint/no-require-imports': 'error',
125
+ 'no-unused-vars': 'off',
126
+ '@typescript-eslint/no-unused-vars': [
127
+ 'warn',
128
+ {
129
+ argsIgnorePattern: '^_',
130
+ varsIgnorePattern: '^_',
131
+ },
132
+ ],
133
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': [
134
+ 'error',
135
+ {
136
+ allowComparingNullableBooleansToTrue: true,
137
+ allowComparingNullableBooleansToFalse: true,
138
+ },
139
+ ],
140
+ '@typescript-eslint/no-unnecessary-condition': 'error',
141
+ '@typescript-eslint/no-unsafe-assignment': 'error',
142
+ '@typescript-eslint/no-unsafe-call': 'error',
143
+ '@typescript-eslint/no-unsafe-member-access': 'error',
144
+ '@typescript-eslint/no-unsafe-return': 'error',
145
+ '@typescript-eslint/no-var-requires': 'error',
146
+ '@typescript-eslint/prefer-nullish-coalescing': 'error',
147
+ '@typescript-eslint/prefer-optional-chain': 'error',
148
+ '@typescript-eslint/prefer-readonly': 'warn',
149
+ '@typescript-eslint/prefer-reduce-type-parameter': 'warn',
150
+ '@typescript-eslint/prefer-string-starts-ends-with': 'error',
151
+ '@typescript-eslint/prefer-ts-expect-error': 'warn',
152
+ '@typescript-eslint/promise-function-async': 'error',
153
+ 'require-await': 'off',
154
+ '@typescript-eslint/require-await': 'error',
155
+ '@typescript-eslint/restrict-plus-operands': 'warn',
156
+ 'no-return-await': 'off',
157
+ '@typescript-eslint/return-await': ['error', 'in-try-catch'],
158
+ '@typescript-eslint/strict-boolean-expressions': [
159
+ 'error',
160
+ {
161
+ allowString: false,
162
+ allowNumber: false,
163
+ allowNullableObject: false,
164
+ allowNullableBoolean: false,
165
+ allowNullableString: false,
166
+ allowNullableNumber: false,
167
+ allowAny: false,
168
+ allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
169
+ },
170
+ ],
171
+ '@typescript-eslint/unbound-method': 'error',
172
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
173
+ },
174
+ },
175
+ ];
package/.eslintrc.js DELETED
@@ -1,9 +0,0 @@
1
- /* global __dirname */
2
- const { resolve } = require('path');
3
-
4
- module.exports = {
5
- extends: ['./index'],
6
- parserOptions: {
7
- project: resolve(__dirname, './tsconfig.json'),
8
- },
9
- };
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- extends: ['./partials/eslint', './partials/typescript', './partials/style', './partials/testing'],
3
- reportUnusedDisableDirectives: true,
4
- };
package/node.js DELETED
@@ -1,23 +0,0 @@
1
- module.exports = {
2
- extends: ['plugin:n/recommended'],
3
- settings: {
4
- node: {
5
- tryExtensions: ['.js', '.jsx', '.json', '.node', '.d.ts', '.ts', '.tsx'],
6
- },
7
- },
8
- rules: {
9
- 'n/no-sync': 'warn',
10
- 'n/no-missing-import': 'off',
11
- 'n/no-missing-require': 'off',
12
- 'n/prefer-promises/dns': 'warn',
13
- 'n/prefer-promises/fs': 'warn',
14
- },
15
- overrides: [
16
- {
17
- files: ['**/*.ts', '**/*.tsx'],
18
- rules: {
19
- 'n/no-unsupported-features/es-syntax': 'off',
20
- },
21
- },
22
- ],
23
- };
@@ -1,110 +0,0 @@
1
- module.exports = {
2
- extends: ['eslint:recommended', 'plugin:import/recommended', 'plugin:import/typescript'],
3
- parser: 'espree',
4
- env: {
5
- commonjs: true,
6
- es6: true,
7
- es2017: true,
8
- },
9
- rules: {
10
- 'import/first': ['warn'],
11
- 'import/no-cycle': ['error', { ignoreExternal: true }],
12
- 'import/no-duplicates': 'error',
13
- 'import/no-useless-path-segments': ['warn'],
14
- 'array-callback-return': 'error',
15
- 'block-scoped-var': 'warn',
16
- 'complexity': ['warn', { max: 20 }],
17
- 'consistent-return': 'error',
18
- 'curly': ['error', 'all'],
19
- 'default-case': 'error',
20
- 'default-param-last': 'error',
21
- 'dot-notation': 'warn',
22
- 'eqeqeq': ['error', 'always', { null: 'ignore' }],
23
- 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
24
- 'guard-for-in': 'warn',
25
- 'no-alert': 'warn',
26
- 'no-await-in-loop': 'error',
27
- 'no-buffer-constructor': 'error',
28
- 'no-console': 'warn',
29
- 'no-duplicate-imports': 'off',
30
- 'no-eval': 'error',
31
- 'no-extend-native': 'error',
32
- 'no-extra-bind': 'error',
33
- 'no-fallthrough': 'error',
34
- 'no-global-assign': 'error',
35
- 'no-implicit-coercion': 'error',
36
- 'no-implied-eval': 'error',
37
- 'no-iterator': 'error',
38
- 'no-lone-blocks': 'warn',
39
- 'no-lonely-if': 'error',
40
- 'no-loop-func': 'error',
41
- 'no-magic-numbers': [
42
- 'warn',
43
- {
44
- enforceConst: false,
45
- ignore: [0, 1],
46
- ignoreArrayIndexes: true,
47
- },
48
- ],
49
- 'no-multi-str': 'error',
50
- 'no-new': 'error',
51
- 'no-new-func': 'error',
52
- 'no-octal': 'error',
53
- 'no-octal-escape': 'error',
54
- 'no-param-reassign': 'error',
55
- 'no-process-exit': 'off',
56
- 'no-proto': 'error',
57
- 'no-prototype-builtins': 'warn',
58
- 'no-restricted-syntax': [
59
- 'error',
60
- {
61
- selector: 'SequenceExpression',
62
- message: 'The comma operator is confusing and a common mistake. Don’t use it!',
63
- },
64
- ],
65
- 'no-return-assign': ['error', 'always'],
66
- 'no-return-await': 'error',
67
- 'no-self-compare': 'error',
68
- 'no-shadow': 'error',
69
- 'no-sync': 'error',
70
- 'no-template-curly-in-string': 'warn',
71
- 'no-throw-literal': 'error',
72
- 'no-unexpected-multiline': 'error',
73
- 'no-unused-vars': [
74
- 'warn',
75
- {
76
- argsIgnorePattern: '^_',
77
- varsIgnorePattern: '^_',
78
- },
79
- ],
80
- 'no-use-before-define': 'error',
81
- 'no-useless-call': 'error',
82
- 'no-useless-computed-key': 'error',
83
- 'no-useless-concat': 'warn',
84
- 'no-useless-constructor': 'error',
85
- 'no-useless-rename': 'error',
86
- 'no-useless-return': 'error',
87
- 'no-var': 'error',
88
- 'no-void': ['error', { allowAsStatement: true }],
89
- 'no-warning-comments': 'warn',
90
- 'prefer-arrow-callback': 'error',
91
- 'prefer-const': 'error',
92
- 'prefer-numeric-literals': 'error',
93
- 'prefer-promise-reject-errors': 'error',
94
- 'prefer-regex-literals': 'error',
95
- 'prefer-rest-params': 'error',
96
- 'prefer-spread': 'error',
97
- 'prefer-template': 'error',
98
- 'require-atomic-updates': 'warn',
99
- 'require-await': 'error',
100
- 'require-unicode-regexp': 'warn',
101
- 'sort-imports': ['warn', { allowSeparatedGroups: true, ignoreCase: true }],
102
- 'symbol-description': 'error',
103
- },
104
- settings: {
105
- 'import/resolver': {
106
- typescript: true,
107
- node: true,
108
- },
109
- },
110
- };
package/partials/style.js DELETED
@@ -1,29 +0,0 @@
1
- const stylistic = require('@stylistic/eslint-plugin');
2
-
3
- const customized = stylistic.configs.customize({
4
- flat: false,
5
- indent: 'tab',
6
- quotes: 'single',
7
- semi: true,
8
- jsx: true,
9
- commaDangle: 'always-multiline',
10
- quoteProps: 'always',
11
- arrowParens: true,
12
- braceStyle: '1tbs',
13
- });
14
-
15
- module.exports = {
16
- plugins: ['@stylistic'],
17
- extends: ['plugin:@stylistic/disable-legacy'],
18
- rules: {
19
- ...customized.rules,
20
- '@stylistic/generator-star-spacing': ['error', 'after'],
21
- '@stylistic/linebreak-style': ['error', 'unix'],
22
- '@stylistic/quotes': [
23
- 'error',
24
- customized.rules['@stylistic/quotes'][1],
25
- { avoidEscape: true, allowTemplateLiterals: false },
26
- ],
27
- '@stylistic/quote-props': ['error', 'consistent-as-needed'],
28
- },
29
- };
@@ -1,36 +0,0 @@
1
- module.exports = {
2
- overrides: [
3
- {
4
- // Viteshot support.
5
- files: ['**/*.screenshot.{jsx,tsx}'],
6
- rules: {
7
- '@typescript-eslint/explicit-function-return-type': 'off',
8
- '@typescript-eslint/explicit-module-boundary-types': 'off',
9
- },
10
- },
11
- {
12
- // Jest support.
13
- files: [
14
- '**/__tests__/**/*.{ts,js,tsx,jsx}',
15
- '**/__mocks__/**/*.{ts,js,tsx,jsx}',
16
- '**/__utils__/**/*.{ts,js,tsx,jsx}',
17
- ],
18
- plugins: ['jest'],
19
- extends: ['plugin:jest/style', 'plugin:jest/recommended'],
20
- rules: {
21
- '@typescript-eslint/consistent-type-assertions': 'off',
22
- 'jest/prefer-todo': 'error',
23
- 'jest/no-conditional-in-test': 'warn',
24
- 'jest/no-untyped-mock-factory': 'error',
25
- 'jest/prefer-called-with': 'error',
26
- 'jest/prefer-comparison-matcher': 'warn',
27
- 'jest/prefer-equality-matcher': 'warn',
28
- 'jest/prefer-lowercase-title': 'error',
29
- 'jest/prefer-expect-assertions': [
30
- 'error',
31
- { onlyFunctionsWithExpectInLoop: true, onlyFunctionsWithExpectInCallback: true },
32
- ],
33
- },
34
- },
35
- ],
36
- };
@@ -1,179 +0,0 @@
1
- module.exports = {
2
- plugins: ['deprecation'],
3
- rules: {
4
- 'deprecation/deprecation': 'off',
5
- },
6
- overrides: [
7
- {
8
- extends: ['plugin:@typescript-eslint/recommended'],
9
- parser: '@typescript-eslint/parser',
10
- parserOptions: {
11
- project: './tsconfig.json',
12
- },
13
- plugins: ['@typescript-eslint'],
14
- files: ['**/*.ts', '**/*.tsx'],
15
- rules: {
16
- 'deprecation/deprecation': 'warn',
17
- '@typescript-eslint/array-type': [
18
- 'error',
19
- {
20
- default: 'array-simple',
21
- readonly: 'generic',
22
- },
23
- ],
24
- '@typescript-eslint/class-literal-property-style': ['error', 'fields'],
25
- '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
26
- '@typescript-eslint/consistent-type-assertions': [
27
- 'warn',
28
- {
29
- assertionStyle: 'as',
30
- objectLiteralTypeAssertions: 'allow-as-parameter',
31
- },
32
- ],
33
- '@typescript-eslint/consistent-type-imports': [
34
- 'warn',
35
- { prefer: 'type-imports', disallowTypeAnnotations: true },
36
- ],
37
- '@typescript-eslint/explicit-function-return-type': [
38
- 'warn',
39
- {
40
- allowConciseArrowFunctionExpressionsStartingWithVoid: true,
41
- allowDirectConstAssertionInArrowFunctions: false,
42
- allowExpressions: false,
43
- allowHigherOrderFunctions: true,
44
- allowTypedFunctionExpressions: true,
45
- },
46
- ],
47
- 'default-param-last': 'off',
48
- '@typescript-eslint/default-param-last': 'error',
49
- '@typescript-eslint/explicit-member-accessibility': 'error',
50
- '@typescript-eslint/explicit-module-boundary-types': [
51
- 'error',
52
- {
53
- allowArgumentsExplicitlyTypedAsAny: false,
54
- allowDirectConstAssertionInArrowFunctions: false,
55
- allowedNames: [],
56
- allowHigherOrderFunctions: true,
57
- allowTypedFunctionExpressions: true,
58
- },
59
- ],
60
- '@typescript-eslint/indent': 'off',
61
- '@typescript-eslint/member-delimiter-style': 'error',
62
- '@typescript-eslint/method-signature-style': ['error', 'property'],
63
- '@typescript-eslint/no-explicit-any': 'error',
64
- '@typescript-eslint/no-invalid-void-type': 'warn',
65
- 'no-magic-numbers': 'off',
66
- 'no-loop-func': 'off',
67
- '@typescript-eslint/no-loop-func': 'error',
68
- '@typescript-eslint/no-magic-numbers': [
69
- 'warn',
70
- {
71
- enforceConst: false,
72
- ignore: [0, 1],
73
- ignoreArrayIndexes: true,
74
- ignoreEnums: true,
75
- ignoreNumericLiteralTypes: true,
76
- },
77
- ],
78
- '@typescript-eslint/no-misused-new': 'error',
79
- '@typescript-eslint/no-non-null-assertion': 'error',
80
- 'no-shadow': 'off',
81
- '@typescript-eslint/no-shadow': 'error',
82
- '@typescript-eslint/no-type-alias': [
83
- 'error',
84
- {
85
- allowAliases: 'in-unions-and-intersections',
86
- allowLiterals: 'in-unions-and-intersections',
87
- allowCallbacks: 'always',
88
- allowConditionalTypes: 'always',
89
- allowConstructors: 'always',
90
- allowMappedTypes: 'always',
91
- allowTupleTypes: 'always',
92
- },
93
- ],
94
- 'no-use-before-define': 'off',
95
- '@typescript-eslint/no-use-before-define': 'error',
96
- 'no-useless-constructor': 'off',
97
- '@typescript-eslint/no-useless-constructor': 'error',
98
- '@typescript-eslint/prefer-for-of': 'error',
99
- '@typescript-eslint/prefer-function-type': 'error',
100
- '@typescript-eslint/quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
101
- '@typescript-eslint/unified-signatures': 'warn',
102
- '@typescript-eslint/await-thenable': 'error',
103
- '@typescript-eslint/ban-ts-comment': [
104
- 'error',
105
- {
106
- 'ts-expect-error': 'allow-with-description',
107
- 'ts-ignore': false,
108
- 'ts-nocheck': false,
109
- 'ts-check': true,
110
- },
111
- ],
112
- 'dot-notation': 'off',
113
- '@typescript-eslint/dot-notation': 'warn',
114
- '@typescript-eslint/no-base-to-string': 'error',
115
- '@typescript-eslint/no-floating-promises': [
116
- 'error',
117
- {
118
- ignoreVoid: true,
119
- ignoreIIFE: false,
120
- },
121
- ],
122
- 'no-implied-eval': 'off',
123
- '@typescript-eslint/no-implied-eval': 'error',
124
- '@typescript-eslint/no-misused-promises': 'error',
125
- '@typescript-eslint/no-require-imports': 'error',
126
- 'no-throw-literal': 'off',
127
- '@typescript-eslint/no-throw-literal': 'error',
128
- 'no-unused-vars': 'off',
129
- '@typescript-eslint/no-unused-vars': [
130
- 'warn',
131
- {
132
- argsIgnorePattern: '^_',
133
- varsIgnorePattern: '^_',
134
- },
135
- ],
136
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': [
137
- 'error',
138
- {
139
- allowComparingNullableBooleansToTrue: true,
140
- allowComparingNullableBooleansToFalse: true,
141
- },
142
- ],
143
- '@typescript-eslint/no-unnecessary-condition': 'error',
144
- '@typescript-eslint/no-unsafe-assignment': 'error',
145
- '@typescript-eslint/no-unsafe-call': 'error',
146
- '@typescript-eslint/no-unsafe-member-access': 'error',
147
- '@typescript-eslint/no-unsafe-return': 'error',
148
- '@typescript-eslint/no-var-requires': 'error',
149
- '@typescript-eslint/prefer-nullish-coalescing': 'error',
150
- '@typescript-eslint/prefer-optional-chain': 'error',
151
- '@typescript-eslint/prefer-readonly': 'warn',
152
- '@typescript-eslint/prefer-reduce-type-parameter': 'warn',
153
- '@typescript-eslint/prefer-string-starts-ends-with': 'error',
154
- '@typescript-eslint/prefer-ts-expect-error': 'warn',
155
- '@typescript-eslint/promise-function-async': 'error',
156
- 'require-await': 'off',
157
- '@typescript-eslint/require-await': 'error',
158
- '@typescript-eslint/restrict-plus-operands': 'warn',
159
- 'no-return-await': 'off',
160
- '@typescript-eslint/return-await': ['error', 'in-try-catch'],
161
- '@typescript-eslint/strict-boolean-expressions': [
162
- 'error',
163
- {
164
- allowString: false,
165
- allowNumber: false,
166
- allowNullableObject: false,
167
- allowNullableBoolean: false,
168
- allowNullableString: false,
169
- allowNullableNumber: false,
170
- allowAny: false,
171
- allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
172
- },
173
- ],
174
- '@typescript-eslint/unbound-method': 'error',
175
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
176
- },
177
- },
178
- ],
179
- };
package/react.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: ['plugin:react/recommended', 'plugin:react/jsx-runtime', 'plugin:react-hooks/recommended'],
3
- rules: {
4
- 'react/prefer-stateless-function': 'error',
5
- 'react/prop-types': 'off',
6
- },
7
- };