eslint-config-instant 1.1.8 → 1.2.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.
Files changed (3) hide show
  1. package/backend.js +125 -0
  2. package/package.json +4 -4
  3. package/react.js +331 -0
package/backend.js ADDED
@@ -0,0 +1,125 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ extends: [
4
+ 'eslint:recommended',
5
+ 'plugin:@typescript-eslint/eslint-recommended',
6
+ 'plugin:@typescript-eslint/recommended',
7
+ 'plugin:prettier/recommended',
8
+ 'plugin:import/errors',
9
+ 'plugin:import/warnings',
10
+ 'plugin:import/typescript',
11
+ ],
12
+ plugins: ['prettier'],
13
+ parserOptions: {
14
+ ecmaVersion: 2017,
15
+ sourceType: 'module',
16
+ project: './tsconfig.json',
17
+ },
18
+ env: {
19
+ node: true,
20
+ es6: true,
21
+ jest: true,
22
+ },
23
+ settings: {
24
+ 'import/resolver': {
25
+ alias: {
26
+ map: [
27
+ ['@module', './src/modules'],
28
+ ['@common', './src/common'],
29
+ ['@util', './src/util'],
30
+ ],
31
+ extensions: ['.js', '.ts'],
32
+ },
33
+ node: {
34
+ extensions: ['.js', '.ts'],
35
+ },
36
+ },
37
+ 'import/parsers': {
38
+ '@typescript-eslint/parser': ['.ts'],
39
+ },
40
+ },
41
+ rules: {
42
+ '@typescript-eslint/explicit-function-return-type': ['off'],
43
+ '@typescript-eslint/explicit-member-accessibility': [1],
44
+ '@typescript-eslint/interface-name-prefix': [0, 'never'],
45
+ '@typescript-eslint/no-explicit-any': 0,
46
+ '@typescript-eslint/no-namespace': 0,
47
+ '@typescript-eslint/no-inferrable-types': 0,
48
+ 'import/extensions': [
49
+ 1,
50
+ 'never',
51
+ {
52
+ svg: 'always',
53
+ },
54
+ ],
55
+ 'import/no-extraneous-dependencies': [
56
+ 'error',
57
+ {
58
+ devDependencies: true,
59
+ optionalDependencies: false,
60
+ peerDependencies: false,
61
+ },
62
+ ],
63
+ 'no-param-reassign': 0,
64
+ 'no-underscore-dangle': 0,
65
+ 'no-use-before-define': 0,
66
+ 'no-console': ['error', { allow: ['error'] }],
67
+ 'padding-line-between-statements': 'off',
68
+ '@typescript-eslint/padding-line-between-statements': [
69
+ 'error',
70
+ // blank line before return
71
+ { blankLine: 'always', prev: '*', next: 'return' },
72
+ // blank line before and after block like statements
73
+ { blankLine: 'always', prev: '*', next: 'block-like' },
74
+ { blankLine: 'always', prev: 'block-like', next: '*' },
75
+ // blank line before and after function declarations
76
+ { blankLine: 'always', prev: '*', next: 'function' },
77
+ { blankLine: 'always', prev: 'function', next: '*' }
78
+ ],
79
+ 'spaced-comment': 'error',
80
+ // default case in a switch needs to be last
81
+ 'default-case-last': 'error',
82
+
83
+ 'import/order': [
84
+ 'error',
85
+ {
86
+ alphabetize: {
87
+ order: 'asc',
88
+ caseInsensitive: true,
89
+ },
90
+ groups: ['builtin', 'external', ['internal', 'parent'], ['sibling', 'index']],
91
+ pathGroups: [
92
+ {
93
+ pattern: 'react',
94
+ group: 'external',
95
+ position: 'before',
96
+ },
97
+ {
98
+ pattern: '@**',
99
+ group: 'internal',
100
+ position: 'before',
101
+ },
102
+ {
103
+ pattern: '@**/**',
104
+ group: 'internal',
105
+ position: 'before',
106
+ },
107
+ ],
108
+ pathGroupsExcludedImportTypes: [],
109
+ },
110
+ ],
111
+
112
+ 'prettier/prettier': [
113
+ 'error',
114
+ {
115
+ printWidth: 120,
116
+ semi: true,
117
+ singleQuote: true,
118
+ tabWidth: 2,
119
+ trailingComma: 'none',
120
+ useTabs: false,
121
+ arrowParens: 'avoid',
122
+ },
123
+ ],
124
+ },
125
+ };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "eslint-config-instant",
3
- "version": "1.1.8",
3
+ "version": "1.2.0",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js",
7
- "web.js",
8
- "node.js"
7
+ "react.js",
8
+ "backend.js"
9
9
  ],
10
10
  "scripts": {
11
11
  "lint": "eslint .",
@@ -40,7 +40,7 @@
40
40
  "eslint-plugin-react": "7.30.0",
41
41
  "eslint-plugin-react-hooks": "4.5.0",
42
42
  "prettier": "2.6.2",
43
- "semantic-release": "19.0.2",
43
+ "semantic-release": "19.0.3",
44
44
  "typescript": "4.7.3"
45
45
  },
46
46
  "license": "MIT",
package/react.js ADDED
@@ -0,0 +1,331 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['prettier', 'plugin:mdx/recommended'],
4
+ plugins: ['import', 'jsx-a11y', 'react', 'react-hooks', 'prettier'],
5
+ env: {
6
+ browser: true,
7
+ commonjs: true,
8
+ es6: true,
9
+ jest: true,
10
+ node: true,
11
+ },
12
+ parserOptions: {
13
+ ecmaVersion: 2018,
14
+ sourceType: 'module',
15
+ ecmaFeatures: {
16
+ jsx: true,
17
+ },
18
+ },
19
+ settings: {
20
+ react: {
21
+ version: 'detect',
22
+ },
23
+ 'import/resolver': {
24
+ alias: [
25
+ ['~components', './src/components'],
26
+ ['~styles', './src/styles'],
27
+ ['~hooks', './src/hooks'],
28
+ ['~config', './src/config'],
29
+ ['~lib', './src/lib'],
30
+ ],
31
+ },
32
+ },
33
+ overrides: [
34
+ {
35
+ files: [
36
+ '*.stories.js',
37
+ '*.stories.tsx',
38
+ '*.stories.ts',
39
+ '*.test.tsx',
40
+ '*.test.ts',
41
+ 'test-utils.tsx',
42
+ ],
43
+ rules: {
44
+ 'import/no-extraneous-dependencies': 'off',
45
+ 'import/named': 'off', //@todo fix fireEvent not found in test-utils
46
+ },
47
+ },
48
+ {
49
+ files: ['**/*.ts?(x)'],
50
+ parser: '@typescript-eslint/parser',
51
+ parserOptions: {
52
+ ecmaVersion: 2018,
53
+ sourceType: 'module',
54
+ ecmaFeatures: {
55
+ jsx: true,
56
+ },
57
+ // typescript-eslint specific options
58
+ warnOnUnsupportedTypeScriptVersion: true,
59
+ },
60
+ plugins: ['@typescript-eslint'],
61
+ // If adding a typescript-eslint version of an existing ESLint rule,
62
+ // make sure to disable the ESLint rule here.
63
+ rules: {
64
+ // TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)
65
+ 'default-case': 'off',
66
+ // 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
67
+ 'no-dupe-class-members': 'off',
68
+ // 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
69
+ 'no-undef': 'off',
70
+
71
+ // Add TypeScript specific rules (and turn off ESLint equivalents)
72
+ '@typescript-eslint/consistent-type-assertions': 'warn',
73
+ 'no-array-constructor': 'off',
74
+ '@typescript-eslint/no-array-constructor': 'warn',
75
+ 'no-use-before-define': 'off',
76
+ '@typescript-eslint/no-use-before-define': [
77
+ 'warn',
78
+ {
79
+ functions: false,
80
+ classes: false,
81
+ variables: false,
82
+ typedefs: false,
83
+ },
84
+ ],
85
+ 'no-unused-expressions': 'off',
86
+ '@typescript-eslint/no-unused-expressions': [
87
+ 'error',
88
+ {
89
+ allowShortCircuit: true,
90
+ allowTernary: true,
91
+ allowTaggedTemplates: true,
92
+ },
93
+ ],
94
+ 'no-unused-vars': 'off',
95
+ '@typescript-eslint/no-unused-vars': [
96
+ 'warn',
97
+ {
98
+ args: 'none',
99
+ ignoreRestSiblings: true,
100
+ },
101
+ ],
102
+ 'no-useless-constructor': 'off',
103
+ '@typescript-eslint/no-useless-constructor': 'warn',
104
+ },
105
+ },
106
+ ],
107
+ // NOTE: When adding rules here, you need to make sure they are compatible with
108
+ // `typescript-eslint`, as some rules such as `no-array-constructor` aren't compatible.
109
+ rules: {
110
+ // http://eslint.org/docs/rules/
111
+ 'array-callback-return': 'error',
112
+ 'default-case': ['error', { commentPattern: '^no default$' }],
113
+ 'dot-location': ['error', 'property'],
114
+ eqeqeq: ['error', 'smart'],
115
+ 'new-parens': 'error',
116
+ 'no-array-constructor': 'error',
117
+ 'no-caller': 'error',
118
+ 'no-cond-assign': ['error', 'except-parens'],
119
+ 'no-const-assign': 'error',
120
+ 'no-control-regex': 'error',
121
+ 'no-delete-var': 'error',
122
+ 'no-dupe-args': 'error',
123
+ 'no-dupe-class-members': 'error',
124
+ 'no-dupe-keys': 'error',
125
+ 'no-duplicate-case': 'error',
126
+ 'no-empty-character-class': 'error',
127
+ 'no-empty-pattern': 'error',
128
+ 'no-eval': 'error',
129
+ 'no-ex-assign': 'error',
130
+ 'no-extend-native': 'error',
131
+ 'no-extra-bind': 'error',
132
+ 'no-extra-label': 'error',
133
+ 'no-fallthrough': 'error',
134
+ 'no-func-assign': 'error',
135
+ 'no-implied-eval': 'error',
136
+ 'no-invalid-regexp': 'error',
137
+ 'no-iterator': 'error',
138
+ 'no-label-var': 'error',
139
+ 'no-labels': ['error', { allowLoop: true, allowSwitch: false }],
140
+ 'no-lone-blocks': 'error',
141
+ 'no-loop-func': 'error',
142
+ 'no-mixed-operators': [
143
+ 'error',
144
+ {
145
+ groups: [
146
+ ['&', '|', '^', '~', '<<', '>>', '>>>'],
147
+ ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
148
+ ['&&', '||'],
149
+ ['in', 'instanceof'],
150
+ ],
151
+ allowSamePrecedence: false,
152
+ },
153
+ ],
154
+ 'no-multi-str': 'error',
155
+ 'no-native-reassign': 'error',
156
+ 'no-negated-in-lhs': 'error',
157
+ 'no-new-func': 'error',
158
+ 'no-new-object': 'error',
159
+ 'no-new-symbol': 'error',
160
+ 'no-new-wrappers': 'error',
161
+ 'no-obj-calls': 'error',
162
+ 'no-octal': 'error',
163
+ 'no-octal-escape': 'error',
164
+ // TODO: Remove this option in the next major release of CRA.
165
+ // https://eslint.org/docs/user-guide/migrating-to-6.0.0#-the-no-redeclare-rule-is-now-more-strict-by-default
166
+ 'no-redeclare': ['error', { builtinGlobals: false }],
167
+ 'no-regex-spaces': 'error',
168
+ 'no-restricted-syntax': ['error', 'WithStatement'],
169
+ 'no-script-url': 'error',
170
+ 'no-self-assign': 'error',
171
+ 'no-self-compare': 'error',
172
+ 'no-sequences': 'error',
173
+ 'no-shadow-restricted-names': 'error',
174
+ 'no-sparse-arrays': 'error',
175
+ 'no-template-curly-in-string': 'error',
176
+ 'no-this-before-super': 'error',
177
+ 'no-throw-literal': 'error',
178
+ 'no-undef': 'error',
179
+ 'no-unreachable': 'error',
180
+ 'no-unused-expressions': [
181
+ 'error',
182
+ {
183
+ allowShortCircuit: true,
184
+ allowTernary: true,
185
+ allowTaggedTemplates: true,
186
+ },
187
+ ],
188
+ 'no-unused-labels': 'error',
189
+ 'no-unused-vars': [
190
+ 'error',
191
+ {
192
+ args: 'none',
193
+ ignoreRestSiblings: true,
194
+ },
195
+ ],
196
+ 'no-use-before-define': [
197
+ 'error',
198
+ {
199
+ functions: false,
200
+ classes: false,
201
+ variables: false,
202
+ },
203
+ ],
204
+ 'no-useless-computed-key': 'error',
205
+ 'no-useless-concat': 'error',
206
+ 'no-useless-constructor': 'error',
207
+ 'no-useless-escape': 'error',
208
+ 'no-useless-rename': [
209
+ 'error',
210
+ {
211
+ ignoreDestructuring: false,
212
+ ignoreImport: false,
213
+ ignoreExport: false,
214
+ },
215
+ ],
216
+ 'no-with': 'error',
217
+ 'no-whitespace-before-property': 'error',
218
+ 'react-hooks/exhaustive-deps': 'off',
219
+ 'require-yield': 'error',
220
+ 'rest-spread-spacing': ['error', 'never'],
221
+ strict: ['error', 'never'],
222
+ 'unicode-bom': ['error', 'never'],
223
+ 'use-isnan': 'error',
224
+ 'valid-typeof': 'error',
225
+ 'no-restricted-properties': [
226
+ 'error',
227
+ {
228
+ object: 'require',
229
+ property: 'ensure',
230
+ message:
231
+ 'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
232
+ },
233
+ {
234
+ object: 'System',
235
+ property: 'import',
236
+ message:
237
+ 'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
238
+ },
239
+ ],
240
+ 'getter-return': 'error',
241
+ // https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
242
+ 'import/first': 'error',
243
+ 'import/no-amd': 'error',
244
+ 'import/no-webpack-loader-syntax': 'error',
245
+ // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
246
+ 'react/forbid-foreign-prop-types': ['error', { allowInPropTypes: true }],
247
+ 'react/jsx-no-comment-textnodes': 'error',
248
+ 'react/jsx-no-duplicate-props': 'error',
249
+ 'react/jsx-no-target-blank': 'error',
250
+ 'react/jsx-no-undef': 'error',
251
+ 'react/jsx-pascal-case': [
252
+ 'error',
253
+ {
254
+ allowAllCaps: true,
255
+ ignore: [],
256
+ },
257
+ ],
258
+ 'react/jsx-uses-react': 'error',
259
+ 'react/jsx-uses-vars': 'error',
260
+ 'react/no-danger-with-children': 'error',
261
+ // Disabled because of undesirable warnings
262
+ // See https://github.com/facebook/create-react-app/issues/5204 for
263
+ // blockers until its re-enabled
264
+ // 'react/no-deprecated': 'warn',
265
+ 'react/no-direct-mutation-state': 'error',
266
+ 'react/no-is-mounted': 'error',
267
+ 'react/no-typos': 'error',
268
+ // 'react/react-in-jsx-scope': 'error',
269
+ 'react/require-render-return': 'error',
270
+ 'react/style-prop-object': 'error',
271
+ // https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
272
+ 'jsx-a11y/accessible-emoji': 'error',
273
+ 'jsx-a11y/alt-text': 'error',
274
+ 'jsx-a11y/anchor-has-content': 'error',
275
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
276
+ 'jsx-a11y/aria-props': 'error',
277
+ 'jsx-a11y/aria-proptypes': 'error',
278
+ 'jsx-a11y/aria-role': ['error', { ignoreNonDOM: true }],
279
+ 'jsx-a11y/aria-unsupported-elements': 'error',
280
+ 'jsx-a11y/heading-has-content': 'error',
281
+ 'jsx-a11y/iframe-has-title': 'error',
282
+ 'jsx-a11y/img-redundant-alt': 'error',
283
+ 'jsx-a11y/no-access-key': 'error',
284
+ 'jsx-a11y/no-distracting-elements': 'error',
285
+ 'jsx-a11y/no-redundant-roles': 'error',
286
+ 'jsx-a11y/role-has-required-aria-props': 'error',
287
+ 'jsx-a11y/role-supports-aria-props': 'error',
288
+ 'jsx-a11y/scope': 'error',
289
+ // https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks
290
+ 'react-hooks/rules-of-hooks': 'error',
291
+ 'import/order': [
292
+ 'error',
293
+ {
294
+ alphabetize: {
295
+ order: 'asc',
296
+ caseInsensitive: true,
297
+ },
298
+ groups: ['builtin', 'external', ['internal', 'parent'], ['sibling', 'index']],
299
+ pathGroups: [
300
+ {
301
+ pattern: 'react',
302
+ group: 'external',
303
+ position: 'before',
304
+ },
305
+ {
306
+ pattern: '~**',
307
+ group: 'internal',
308
+ position: 'before',
309
+ },
310
+ {
311
+ pattern: '~**/**',
312
+ group: 'internal',
313
+ position: 'before',
314
+ },
315
+ ],
316
+ pathGroupsExcludedImportTypes: [],
317
+ },
318
+ ],
319
+ 'prettier/prettier': [
320
+ 'error',
321
+ {
322
+ printWidth: 80,
323
+ semi: true,
324
+ singleQuote: true,
325
+ tabWidth: 2,
326
+ trailingComma: 'all',
327
+ useTabs: false,
328
+ },
329
+ ],
330
+ },
331
+ };