@asd14/eslint-config 10.3.0 → 11.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.
Files changed (61) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +24 -177
  3. package/dist/types/eslint.config.d.ts +172 -0
  4. package/dist/types/src/configs/dev-files.d.ts +14 -0
  5. package/dist/types/src/configs/node-jest.d.ts +17 -0
  6. package/dist/types/src/configs/node.d.ts +248 -0
  7. package/dist/types/src/configs/react-jest.d.ts +20 -0
  8. package/dist/types/src/configs/react.d.ts +1519 -0
  9. package/dist/types/src/configs/ts-node.d.ts +290 -0
  10. package/dist/types/src/index.d.ts +6 -0
  11. package/dist/types/src/rules/base.d.ts +16 -0
  12. package/dist/types/src/rules/import-dev.d.ts +9 -0
  13. package/dist/types/src/rules/import.d.ts +44 -0
  14. package/dist/types/src/rules/jsdoc.d.ts +40 -0
  15. package/dist/types/src/rules/nx-dev.d.ts +13 -0
  16. package/dist/types/src/rules/nx.d.ts +45 -0
  17. package/dist/types/src/rules/react.d.ts +120 -0
  18. package/dist/types/src/rules/rtl.d.ts +13 -0
  19. package/dist/types/src/rules/typescript.d.ts +53 -0
  20. package/dist/types/src/rules/unicorn.d.ts +42 -0
  21. package/dist/types/src/utils/find-up-sync.d.ts +34 -0
  22. package/dist/types/tsconfig.tsbuildinfo +1 -0
  23. package/package.json +51 -67
  24. package/src/configs/dev-files.js +17 -0
  25. package/src/configs/node-jest.js +29 -0
  26. package/src/configs/node.js +68 -0
  27. package/src/configs/react-jest.js +16 -0
  28. package/src/configs/react.js +89 -0
  29. package/src/configs/ts-node.js +23 -0
  30. package/src/index.js +6 -0
  31. package/src/rules/base.js +24 -0
  32. package/src/rules/import-dev.js +31 -0
  33. package/src/rules/import.js +55 -0
  34. package/src/rules/jsdoc.js +49 -0
  35. package/src/rules/nx-dev.js +23 -0
  36. package/src/rules/nx.js +81 -0
  37. package/{rules → src/rules}/react.js +41 -27
  38. package/src/rules/rtl.js +6 -0
  39. package/src/rules/typescript.js +88 -0
  40. package/{rules → src/rules}/unicorn.js +19 -41
  41. package/src/utils/find-up-sync.js +56 -0
  42. package/rules/best-practices.js +0 -11
  43. package/rules/comments.js +0 -46
  44. package/rules/errors.js +0 -112
  45. package/rules/es6.js +0 -48
  46. package/rules/html.js +0 -59
  47. package/rules/import-ts.js +0 -41
  48. package/rules/import.js +0 -101
  49. package/rules/jsdoc-ts.js +0 -8
  50. package/rules/jsdoc.js +0 -103
  51. package/rules/json.js +0 -9
  52. package/rules/node.js +0 -56
  53. package/rules/prettier.js +0 -16
  54. package/rules/promise.js +0 -68
  55. package/rules/style.js +0 -252
  56. package/rules/variables.js +0 -70
  57. package/targets/node-esm.js +0 -25
  58. package/targets/node-ts.js +0 -36
  59. package/targets/node.js +0 -36
  60. package/targets/react-ts.js +0 -94
  61. package/targets/react.js +0 -90
package/rules/promise.js DELETED
@@ -1,68 +0,0 @@
1
- module.exports = {
2
- plugins: ["promise"],
3
-
4
- rules: {
5
- /*
6
- * Ensure that each time a then() is applied to a promise, a catch()
7
- * is applied as well. Exceptions are made if you are returning that
8
- * promise.
9
- */
10
- "promise/catch-or-return": "warn",
11
-
12
- /*
13
- * Ensure that inside a then() you make sure to return a new promise
14
- * or value.
15
- *
16
- * http://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html
17
- * (rule #5) for more info on why that's a good idea.
18
- *
19
- * We also allow someone to throw inside a then() which is essentially
20
- * the same as return Promise.reject().
21
- */
22
- "promise/always-return": "off",
23
-
24
- /*
25
- * Ensure that inside a then() or a catch() we always return or throw
26
- * a raw value instead of wrapping in Promise.resolve or Promise.reject
27
- */
28
- "promise/no-return-wrap": ["error", { allowReject: false }],
29
-
30
- // Enforce standard parameter names for Promise constructors
31
- "promise/param-names": "error",
32
-
33
- /*
34
- * Ensure that Promise is included fresh in each file instead of
35
- * relying on the existence of a native promise implementation.
36
- * Helpful if you want to use bluebird or if you don't intend to use
37
- * an ES6 Promise shim.
38
- */
39
- "promise/no-native": "off",
40
-
41
- // Avoid nested .then() or .catch() statements
42
- "promise/no-nesting": "warn",
43
-
44
- // Avoid using promises inside of callbacks
45
- "promise/no-promise-in-callback": "warn",
46
-
47
- // Avoid calling cb() inside of a then() (use nodeify] instead)
48
- "promise/no-callback-in-promise": "warn",
49
-
50
- /*
51
- * Avoid creating new promises outside of utility libs (use pify
52
- * instead)
53
- */
54
- "promise/avoid-new": "warn",
55
-
56
- // Prefer await to then() for reading Promise values
57
- "promise/prefer-await-to-then": "off",
58
-
59
- // Prefer async/await to the callback pattern
60
- "promise/prefer-await-to-callbacks": "off",
61
-
62
- /*
63
- * Disallow return statements inside a callback passed to finally(),
64
- * since nothing would consume what's returned.
65
- */
66
- "promise/no-return-in-finally": "warn",
67
- },
68
- }
package/rules/style.js DELETED
@@ -1,252 +0,0 @@
1
- module.exports = {
2
- /*
3
- * Disabled by prettier
4
- * https://github.com/prettier/eslint-config-prettier/blob/master/index.js
5
- *
6
- * curly: 0,
7
- * "lines-around-comment": 0,
8
- * "max-len": 0,
9
- * "no-confusing-arrow": 0,
10
- * "no-mixed-operators": 0,
11
- * "no-tabs": 0,
12
- * "no-unexpected-multiline": 0,
13
- * quotes: 0,
14
- * // The rest are rules that you never need to enable when using Prettier.
15
- * "array-bracket-newline": "off",
16
- * "array-bracket-spacing": "off",
17
- * "array-element-newline": "off",
18
- * "arrow-parens": "off",
19
- * "arrow-spacing": "off",
20
- * "block-spacing": "off",
21
- * "brace-style": "off",
22
- * "comma-dangle": "off",
23
- * "comma-spacing": "off",
24
- * "comma-style": "off",
25
- * "computed-property-spacing": "off",
26
- * "dot-location": "off",
27
- * "eol-last": "off",
28
- * "func-call-spacing": "off",
29
- * "function-paren-newline": "off",
30
- * "generator-star": "off",
31
- * "generator-star-spacing": "off",
32
- * "implicit-arrow-linebreak": "off",
33
- * indent: "off",
34
- * "indent-legacy": "off",
35
- * "jsx-quotes": "off",
36
- * "key-spacing": "off",
37
- * "keyword-spacing": "off",
38
- * "multiline-ternary": "off",
39
- * "newline-per-chained-call": "off",
40
- * "new-parens": "off",
41
- * "no-arrow-condition": "off",
42
- * "no-comma-dangle": "off",
43
- * "no-extra-parens": "off",
44
- * "no-extra-semi": "off",
45
- * "no-floating-decimal": "off",
46
- * "no-mixed-spaces-and-tabs": "off",
47
- * "no-multi-spaces": "off",
48
- * "no-multiple-empty-lines": "off",
49
- * "no-reserved-keys": "off",
50
- * "no-space-before-semi": "off",
51
- * "no-spaced-func": "off",
52
- * "no-trailing-spaces": "off",
53
- * "no-whitespace-before-property": "off",
54
- * "no-wrap-func": "off",
55
- * "nonblock-statement-body-position": "off",
56
- * "object-curly-newline": "off",
57
- * "object-curly-spacing": "off",
58
- * "object-property-newline": "off",
59
- * "one-var-declaration-per-line": "off",
60
- * "operator-linebreak": "off",
61
- * "padded-blocks": "off",
62
- * "quote-props": "off",
63
- * "rest-spread-spacing": "off",
64
- * semi: "off",
65
- * "semi-spacing": "off",
66
- * "semi-style": "off",
67
- * "space-after-function-name": "off",
68
- * "space-after-keywords": "off",
69
- * "space-before-blocks": "off",
70
- * "space-before-function-paren": "off",
71
- * "space-before-function-parentheses": "off",
72
- * "space-before-keywords": "off",
73
- * "space-in-brackets": "off",
74
- * "space-in-parens": "off",
75
- * "space-infix-ops": "off",
76
- * "space-return-throw-case": "off",
77
- * "space-unary-ops": "off",
78
- * "space-unary-word-ops": "off",
79
- * "switch-colon-spacing": "off",
80
- * "template-curly-spacing": "off",
81
- * "template-tag-spacing": "off",
82
- * "unicode-bom": "off",
83
- * "wrap-iife": "off",
84
- * "wrap-regex": "off",
85
- * "yield-star-spacing": "off"
86
- */
87
-
88
- rules: {
89
- /**
90
- * This rule looks for any underscores (_) located within the source
91
- * code. It ignores leading and trailing underscores and only checks
92
- * those in the middle of a variable name. If ESLint decides that the
93
- * variable is a constant (all uppercase), then no warning will be
94
- * thrown. Otherwise, a warning will be thrown. This rule only flags
95
- * definitions and assignments but not function calls. In case of ES6
96
- * import statements, this rule only targets the name of the variable
97
- * that will be imported into the local module scope.
98
- */
99
- "camelcase": ["error", { properties: "never" }],
100
-
101
- /*
102
- * Enforces two things about variables with the designated alias names
103
- * for this:
104
- * - If a variable with a designated name is declared, it must be
105
- * either initialized (in the declaration) or assigned (in the
106
- * same scope as the declaration) the value this.
107
- *
108
- * - If a variable is initialized or assigned the value this, the
109
- * name of the variable must be a designated alias.
110
- *
111
- * With arrow functions this should not matter and pattern not be
112
- * used anymore.
113
- */
114
- "consistent-this": ["error", "self"],
115
-
116
- /*
117
- * Require or disallow named function expressions
118
- *
119
- * A pattern that’s becoming more common is to give function
120
- * expressions names to aid in debugging. For example:
121
- *
122
- * Foo.prototype.bar = function bar() {};
123
- *
124
- * Adding the second bar in the above example is optional. If you
125
- * leave off the function name then when the function throws an
126
- * exception you are likely to get something similar to anonymous
127
- * function in the stack trace. If you provide the optional name for a
128
- * function expression then you will get the name of the function
129
- * expression in the stack trace.
130
- */
131
- "func-names": ["error", "always"],
132
-
133
- /*
134
- * "There are only two hard things in Computer Science:
135
- * cache invalidation and naming things."
136
- * — Phil Karlton
137
- *
138
- * Bad names can lead to hard-to-decipher code. Generic names, such as
139
- * data, don’t infer much about the code and the values it receives.
140
- * This rule allows you to configure a blacklist of bad identifier
141
- * names, that you don’t want to see in your code.
142
- *
143
- * Removing "data" because VueJS
144
- */
145
- "id-blacklist": ["error", "err", "e", "cb", "callback"],
146
-
147
- /*
148
- * This rule requires constructor names to begin with a capital
149
- * letter. Certain built-in identifiers are exempt from this rule.
150
- * These identifiers are:
151
- */
152
- "new-cap": "error",
153
-
154
- /*
155
- * This rule enforces a coding style where empty lines are required or
156
- * disallowed after var, let, or const statements to achieve a
157
- * consistent coding style across the project.
158
- */
159
- "newline-after-var": ["error", "always"],
160
-
161
- /*
162
- * This rule requires an empty line before return statements to
163
- * increase code clarity, except when the return is alone inside a
164
- * statement group (such as an if statement). In the latter case, the
165
- * return statement does not need to be delineated by virtue of it
166
- * being alone. Comments are ignored and do not count as empty lines.
167
- */
168
- "newline-before-return": "error",
169
-
170
- /*
171
- * This rule disallows if statements as the only statement in else
172
- * blocks.
173
- */
174
- "no-lonely-if": "error",
175
-
176
- /*
177
- * This rule disallows using multiple assignments within a single
178
- * statement.
179
- */
180
- "no-multi-assign": "error",
181
-
182
- // Enforces the consistent use of empty lines.
183
- "no-multiple-empty-lines": [
184
- "error",
185
- {
186
- max: 2,
187
- maxBOF: 0,
188
- maxEOF: 1,
189
- },
190
- ],
191
-
192
- /*
193
- * This rule disallows negated conditions in either of the following:
194
- * - if statements which have an else branch
195
- * - ternary expressions
196
- */
197
- "no-negated-condition": "error",
198
-
199
- /*
200
- * This rule disallow ternary operators when simpler alternatives
201
- * exist.
202
- */
203
- "no-unneeded-ternary": [
204
- "error",
205
- {
206
- defaultAssignment: true,
207
- },
208
- ],
209
-
210
- /*
211
- * This rule enforces variables to be declared either together or
212
- * separately per function ( for var) or block (for let and const)
213
- * scope.
214
- */
215
- "one-var": "off",
216
-
217
- /*
218
- * This rule requires or disallows blank lines between the given 2
219
- * kinds of statements. Properly blank lines help developers to
220
- * understand the code.
221
- */
222
- "padding-line-between-statements": [
223
- "error",
224
- {
225
- blankLine: "always",
226
- next: "return",
227
- prev: "var",
228
- },
229
- ],
230
-
231
- /*
232
- * Checks all property definitions of object expressions and verifies
233
- * That all variables are sorted alphabetically.
234
- */
235
- "sort-keys": "off",
236
-
237
- /*
238
- * This rule checks all variable declaration blocks and verifies that
239
- * all variables are sorted alphabetically. The default configuration
240
- * of the rule is case-sensitive.
241
- */
242
- "sort-vars": "off",
243
-
244
- /*
245
- * This rule improves readability by enforcing lines between class
246
- * members. It will not check empty lines before the first member and
247
- * after the last member, since that is already taken care of by
248
- * padded-blocks.
249
- */
250
- "lines-between-class-members": ["error", "always"],
251
- },
252
- }
@@ -1,70 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // Enforce or disallow variable initializations at definition
4
- "init-declarations": 0,
5
-
6
- /*
7
- * Disallow the catch clause parameter name being the same as a
8
- * variable in the outer scope
9
- */
10
- "no-catch-shadow": 0,
11
-
12
- // Disallow deletion of variables
13
- "no-delete-var": "error",
14
-
15
- // Disallow labels that share a name with a variable
16
- "no-label-var": 0,
17
-
18
- /*
19
- * Disallow declaration of variables already declared in the outer
20
- * scope.
21
- */
22
- "no-shadow": "error",
23
-
24
- // Disallow shadowing of names such as arguments
25
- "no-shadow-restricted-names": "error",
26
-
27
- /*
28
- * Disallow use of undeclared variables unless mentioned in a
29
- * global block
30
- */
31
- "no-undef": "error",
32
-
33
- // Disallow use of undefined when initializing variables
34
- "no-undef-init": 0,
35
-
36
- // Disallow use of undefined variable
37
- "no-undefined": 0,
38
-
39
- // Disallow declaration of variables that are not used in the code
40
- "no-unused-vars": [
41
- "error",
42
- {
43
- args: "after-used",
44
- varsIgnorePattern: "debug",
45
- },
46
- ],
47
-
48
- // Disallow use of variables before they are defined
49
- "no-use-before-define": "error",
50
-
51
- // Require that all functions are run in strict mode
52
- "strict": ["error", "never"],
53
-
54
- /*
55
- * Prefer destructuring from arrays and objects
56
- *
57
- * With JavaScript ES6, a new syntax was added for creating variables
58
- * from an array index or object property, called destructuring. This
59
- * rule enforces usage of destructuring instead of accessing a
60
- * property through a member expression.
61
- */
62
- "prefer-destructuring": [
63
- "warn",
64
- {
65
- object: false,
66
- array: true,
67
- },
68
- ],
69
- },
70
- }
@@ -1,25 +0,0 @@
1
- module.exports = {
2
- parserOptions: {
3
- ecmaVersion: 2021,
4
- sourceType: "module",
5
- },
6
- env: {
7
- node: true,
8
- },
9
- extends: [
10
- "../rules/json",
11
- "../rules/best-practices",
12
- "../rules/comments",
13
- "../rules/errors",
14
- "../rules/es6",
15
- "../rules/jsdoc",
16
- "../rules/node",
17
- "../rules/promise",
18
- "../rules/style",
19
- "../rules/unicorn",
20
- "../rules/variables",
21
- "../rules/prettier",
22
- ].map(require.resolve),
23
- plugins: ["no-inferred-method-name"],
24
- settings: {},
25
- }
@@ -1,36 +0,0 @@
1
- module.exports = {
2
- parser: "@typescript-eslint/parser",
3
- parserOptions: {
4
- ecmaVersion: 2021,
5
- sourceType: "module",
6
- },
7
- env: {
8
- node: true,
9
- es6: true,
10
- },
11
- extends: [
12
- ...[
13
- "../rules/json",
14
- "../rules/best-practices",
15
- "../rules/comments",
16
- "../rules/errors",
17
- "../rules/es6",
18
- "../rules/import",
19
- "../rules/import-ts",
20
- "../rules/jsdoc",
21
- "../rules/jsdoc-ts",
22
- "../rules/node",
23
- "../rules/promise",
24
- "../rules/style",
25
- "../rules/unicorn",
26
- "../rules/variables",
27
- "../rules/prettier",
28
- ].map(require.resolve),
29
- "plugin:@typescript-eslint/recommended",
30
- ],
31
- plugins: ["no-inferred-method-name"],
32
- rules: {
33
- "@typescript-eslint/no-var-requires": "off",
34
- "@typescript-eslint/ban-ts-comment": "warn",
35
- },
36
- }
package/targets/node.js DELETED
@@ -1,36 +0,0 @@
1
- module.exports = {
2
- parserOptions: {
3
- ecmaVersion: 2021,
4
- sourceType: "module",
5
- },
6
- env: {
7
- node: true,
8
- },
9
- extends: [
10
- "../rules/json",
11
- "../rules/best-practices",
12
- "../rules/comments",
13
- "../rules/errors",
14
- "../rules/es6",
15
- "../rules/import",
16
- "../rules/jsdoc",
17
- "../rules/node",
18
- "../rules/promise",
19
- "../rules/style",
20
- "../rules/unicorn",
21
- "../rules/variables",
22
- "../rules/prettier",
23
- ].map(require.resolve),
24
- plugins: ["no-inferred-method-name"],
25
- settings: {
26
- "import/resolver": {
27
- node: {
28
- extensions: [".js"],
29
-
30
- // Can add a path segment here that will act like a source root, for
31
- // in-project aliasing (i.e. `import MyStore from 'stores/my-store'`)
32
- moduleDirectory: ["node_modules", "src"],
33
- },
34
- },
35
- },
36
- }
@@ -1,94 +0,0 @@
1
- module.exports = {
2
- parser: "@typescript-eslint/parser",
3
- parserOptions: {
4
- ecmaVersion: 2021,
5
- sourceType: "module",
6
- ecmaFeatures: {
7
- jsx: true,
8
- },
9
- },
10
- env: {
11
- browser: true,
12
- es6: true,
13
- node: false,
14
- },
15
- extends: [
16
- ...[
17
- "../rules/json",
18
- "../rules/best-practices",
19
- "../rules/comments",
20
- "../rules/errors",
21
- "../rules/es6",
22
- "../rules/html",
23
- "../rules/import",
24
- "../rules/import-ts",
25
- "../rules/jsdoc",
26
- "../rules/jsdoc-ts",
27
- "../rules/promise",
28
- "../rules/react",
29
- "../rules/style",
30
- "../rules/unicorn",
31
- "../rules/variables",
32
- "../rules/prettier",
33
- ].map(require.resolve),
34
-
35
- "plugin:@typescript-eslint/recommended",
36
- ],
37
- plugins: ["no-inferred-method-name"],
38
- rules: {
39
- "react/prop-types": "off",
40
-
41
- "@typescript-eslint/no-var-requires": "off",
42
-
43
- // Restrict file extensions that may contain JSX
44
- "react/jsx-filename-extension": [
45
- "error",
46
- { extensions: [".js", ".jsx", ".tsx", ".ts"] },
47
- ],
48
-
49
- // Let Typescript handle it
50
- "@typescript-eslint/no-use-before-define": "error",
51
- "no-use-before-define": "off",
52
-
53
- /*
54
- * A list of file extensions that will be parsed as modules and
55
- * inspected for exports.
56
- */
57
- "import/extensions": [
58
- "error",
59
- "always",
60
- {
61
- js: "never",
62
- ts: "never",
63
- jsx: "never",
64
- tsx: "never",
65
- },
66
- ],
67
- },
68
- settings: {
69
- "react": {
70
- version: "detect",
71
- },
72
-
73
- /*
74
- * A list of regex strings that, if matched by a path, will not report
75
- * the matching module if no exports are found.
76
- */
77
- "import/ignore": [".(sass|scss|less|css)$"],
78
-
79
- /*
80
- * A list of file extensions that will be parsed as modules and
81
- * inspected for exports.
82
- */
83
- "import/extensions": [
84
- "error",
85
- "always",
86
- {
87
- js: "never",
88
- ts: "never",
89
- jsx: "never",
90
- tsx: "never",
91
- },
92
- ],
93
- },
94
- }
package/targets/react.js DELETED
@@ -1,90 +0,0 @@
1
- module.exports = {
2
- parserOptions: {
3
- ecmaVersion: 2021,
4
- sourceType: "module",
5
- ecmaFeatures: {
6
- classes: true,
7
- impliedStrict: true,
8
- jsx: true,
9
- },
10
- },
11
-
12
- env: {
13
- browser: true,
14
- es6: true,
15
- node: false,
16
- },
17
-
18
- extends: [
19
- "../rules/json",
20
- "../rules/best-practices",
21
- "../rules/comments",
22
- "../rules/errors",
23
- "../rules/es6",
24
- "../rules/html",
25
- "../rules/import",
26
- "../rules/jsdoc",
27
- "../rules/promise",
28
- "../rules/react",
29
- "../rules/style",
30
- "../rules/unicorn",
31
- "../rules/variables",
32
- "../rules/prettier",
33
- ].map(require.resolve),
34
-
35
- plugins: ["no-inferred-method-name"],
36
-
37
- rules: {
38
- "no-unused-vars": [
39
- "error",
40
- {
41
- args: "after-used",
42
- varsIgnorePattern: "debug",
43
- },
44
- ],
45
-
46
- /*
47
- * A list of file extensions that will be parsed as modules and
48
- * inspected for exports.
49
- */
50
- "import/extensions": [
51
- "error",
52
- "always",
53
- {
54
- js: "never",
55
- jsx: "never",
56
- },
57
- ],
58
-
59
- // Restrict file extensions that may contain JSX
60
- "react/jsx-filename-extension": ["error", { extensions: [".js", ".jsx"] }],
61
- },
62
-
63
- settings: {
64
- "react": {
65
- version: "detect",
66
- },
67
-
68
- /*
69
- * A list of regex strings that, if matched by a path, will not report
70
- * the matching module if no exports are found.
71
- */
72
- "import/ignore": [".(sass|scss|less|css)$"],
73
-
74
- /*
75
- * Can add a path segment here that will act like a source root, for
76
- * in-project aliasing (i.e. `import MyStore from 'stores/my-store'`)
77
- */
78
- "import/resolver": {
79
- node: {
80
- extensions: [".js", ".jsx"],
81
-
82
- /*
83
- * Can add a path segment here that will act like a source root, for
84
- * in-project aliasing (i.e. `import MyStore from 'stores/my-store'`)
85
- */
86
- moduleDirectory: ["node_modules", "src"],
87
- },
88
- },
89
- },
90
- }