eslint-config-airbnb-extended 0.3.1 → 0.5.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 (66) hide show
  1. package/README.md +10 -0
  2. package/dist/@types/index.d.ts +22 -0
  3. package/dist/configs/base/index.js +26 -0
  4. package/dist/{base → configs/base}/recommended.js +4 -4
  5. package/dist/configs/index.js +34 -0
  6. package/dist/{react → configs/react}/index.js +5 -4
  7. package/dist/{react → configs/react}/recommended.js +5 -6
  8. package/dist/configs/typescript/index.js +14 -0
  9. package/dist/{typescript → configs/typescript}/recommended.js +7 -6
  10. package/dist/helpers/getDevDepsList.js +1 -2
  11. package/dist/index.js +11 -37
  12. package/dist/plugins/index.js +21 -0
  13. package/dist/plugins/nextPlugin.js +12 -0
  14. package/dist/plugins/reactA11yPlugin.js +12 -0
  15. package/dist/plugins/reactHooksPlugin.js +44 -0
  16. package/dist/plugins/reactPlugin.js +13 -0
  17. package/dist/plugins/typescriptEslintPlugin.js +13 -0
  18. package/dist/rules/best-practices.js +65 -42
  19. package/dist/rules/errors.js +24 -32
  20. package/dist/rules/es6.js +2 -33
  21. package/dist/rules/imports.js +9 -14
  22. package/dist/rules/importsStrict.js +3 -16
  23. package/dist/rules/index.js +22 -0
  24. package/dist/rules/next.js +2 -4
  25. package/dist/rules/node.js +2 -1
  26. package/dist/rules/react-a11y.js +81 -80
  27. package/dist/rules/react-hooks.js +6 -42
  28. package/dist/rules/react.js +374 -340
  29. package/dist/rules/reactStrict.js +86 -0
  30. package/dist/rules/strict.js +2 -1
  31. package/dist/rules/style.js +38 -365
  32. package/dist/rules/stylistic.js +526 -0
  33. package/dist/rules/typescript/typescriptBase.js +3 -2
  34. package/dist/rules/typescript/typescriptEslint.js +22 -34
  35. package/dist/rules/typescript/typescriptImports.js +8 -4
  36. package/dist/rules/variables.js +2 -3
  37. package/package.json +3 -3
  38. package/dist/base/index.d.ts +0 -990
  39. package/dist/base/index.js +0 -23
  40. package/dist/base/recommended.d.ts +0 -990
  41. package/dist/helpers/getDevDepsList.d.ts +0 -3
  42. package/dist/index.d.ts +0 -17982
  43. package/dist/react/index.d.ts +0 -1793
  44. package/dist/react/recommended.d.ts +0 -2786
  45. package/dist/rules/best-practices.d.ts +0 -177
  46. package/dist/rules/errors.d.ts +0 -69
  47. package/dist/rules/es6.d.ts +0 -146
  48. package/dist/rules/imports.d.ts +0 -151
  49. package/dist/rules/importsStrict.d.ts +0 -43
  50. package/dist/rules/next.d.ts +0 -8
  51. package/dist/rules/node.d.ts +0 -90
  52. package/dist/rules/react-a11y.d.ts +0 -117
  53. package/dist/rules/react-hooks.d.ts +0 -19
  54. package/dist/rules/react.d.ts +0 -1659
  55. package/dist/rules/strict.d.ts +0 -7
  56. package/dist/rules/style.d.ts +0 -320
  57. package/dist/rules/typescript/typescriptBase.d.ts +0 -23
  58. package/dist/rules/typescript/typescriptEslint.d.ts +0 -3
  59. package/dist/rules/typescript/typescriptImports.d.ts +0 -37
  60. package/dist/rules/typescript.d.ts +0 -47
  61. package/dist/rules/typescript.js +0 -9
  62. package/dist/rules/variables.d.ts +0 -35
  63. package/dist/typescript/index.d.ts +0 -58
  64. package/dist/typescript/index.js +0 -11
  65. package/dist/typescript/recommended.d.ts +0 -112
  66. package/dist/utils/index.d.ts +0 -13
@@ -3,19 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const typescript_eslint_1 = require("typescript-eslint");
7
6
  const best_practices_1 = __importDefault(require("../../rules/best-practices"));
8
- const errors_1 = __importDefault(require("../../rules/errors"));
9
7
  const es6_1 = __importDefault(require("../../rules/es6"));
10
8
  const style_1 = __importDefault(require("../../rules/style"));
9
+ const stylistic_1 = __importDefault(require("../../rules/stylistic"));
11
10
  const variables_1 = __importDefault(require("../../rules/variables"));
12
- exports.default = {
13
- name: 'airbnb/config/typescript/eslint',
14
- plugins: {
15
- '@typescript-eslint': typescript_eslint_1.plugin,
16
- },
11
+ const typescriptEslintRules = {
12
+ name: 'airbnb/config/typescript/typescript-eslint',
17
13
  languageOptions: {
18
- parser: typescript_eslint_1.parser,
19
14
  parserOptions: {
20
15
  projectService: true,
21
16
  },
@@ -24,7 +19,7 @@ exports.default = {
24
19
  // Replace Airbnb 'brace-style' rule with '@typescript-eslint' version
25
20
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/brace-style.md
26
21
  'brace-style': 'off',
27
- '@typescript-eslint/brace-style': style_1.default.rules['brace-style'],
22
+ '@typescript-eslint/brace-style': stylistic_1.default.rules['brace-style'],
28
23
  // Replace Airbnb 'camelcase' rule with '@typescript-eslint/naming-convention'
29
24
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
30
25
  camelcase: 'off',
@@ -52,13 +47,13 @@ exports.default = {
52
47
  // The TypeScript version also adds 3 new options, all of which should be set to the same value as the base config
53
48
  'comma-dangle': 'off',
54
49
  '@typescript-eslint/comma-dangle': [
55
- style_1.default.rules['comma-dangle'][0],
56
- Object.assign(Object.assign({}, style_1.default.rules['comma-dangle'][1]), { enums: style_1.default.rules['comma-dangle'][1].arrays, generics: style_1.default.rules['comma-dangle'][1].arrays, tuples: style_1.default.rules['comma-dangle'][1].arrays }),
50
+ stylistic_1.default.rules['comma-dangle'][0],
51
+ Object.assign(Object.assign({}, stylistic_1.default.rules['comma-dangle'][1]), { enums: stylistic_1.default.rules['comma-dangle'][1].arrays, generics: stylistic_1.default.rules['comma-dangle'][1].arrays, tuples: stylistic_1.default.rules['comma-dangle'][1].arrays }),
57
52
  ],
58
53
  // Replace Airbnb 'comma-spacing' rule with '@typescript-eslint' version
59
54
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
60
55
  'comma-spacing': 'off',
61
- '@typescript-eslint/comma-spacing': style_1.default.rules['comma-spacing'],
56
+ '@typescript-eslint/comma-spacing': stylistic_1.default.rules['comma-spacing'],
62
57
  // Replace Airbnb 'default-param-last' rule with '@typescript-eslint' version
63
58
  // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md
64
59
  'default-param-last': 'off',
@@ -70,19 +65,15 @@ exports.default = {
70
65
  // Replace Airbnb 'func-call-spacing' rule with '@typescript-eslint' version
71
66
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
72
67
  'func-call-spacing': 'off',
73
- '@typescript-eslint/func-call-spacing': style_1.default.rules['func-call-spacing'],
68
+ '@typescript-eslint/func-call-spacing': stylistic_1.default.rules['func-call-spacing'],
74
69
  // Replace Airbnb 'indent' rule with '@typescript-eslint' version
75
70
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
76
71
  indent: 'off',
77
- '@typescript-eslint/indent': style_1.default.rules.indent,
72
+ '@typescript-eslint/indent': stylistic_1.default.rules.indent,
78
73
  // Replace Airbnb 'keyword-spacing' rule with '@typescript-eslint' version
79
74
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
80
75
  'keyword-spacing': 'off',
81
- '@typescript-eslint/keyword-spacing': style_1.default.rules['keyword-spacing'],
82
- // Replace Airbnb 'lines-between-class-members' rule with '@typescript-eslint' version
83
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
84
- 'lines-between-class-members': 'off',
85
- '@typescript-eslint/lines-between-class-members': style_1.default.rules['lines-between-class-members'],
76
+ '@typescript-eslint/keyword-spacing': stylistic_1.default.rules['keyword-spacing'],
86
77
  // Replace Airbnb 'no-array-constructor' rule with '@typescript-eslint' version
87
78
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
88
79
  'no-array-constructor': 'off',
@@ -98,20 +89,16 @@ exports.default = {
98
89
  // Replace Airbnb 'no-extra-parens' rule with '@typescript-eslint' version
99
90
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
100
91
  'no-extra-parens': 'off',
101
- '@typescript-eslint/no-extra-parens': errors_1.default.rules['no-extra-parens'],
92
+ '@typescript-eslint/no-extra-parens': stylistic_1.default.rules['no-extra-parens'],
102
93
  // Replace Airbnb 'no-extra-semi' rule with '@typescript-eslint' version
103
94
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
104
95
  'no-extra-semi': 'off',
105
- '@typescript-eslint/no-extra-semi': errors_1.default.rules['no-extra-semi'],
96
+ '@typescript-eslint/no-extra-semi': stylistic_1.default.rules['no-extra-semi'],
106
97
  // Replace Airbnb 'no-implied-eval' and 'no-new-func' rules with '@typescript-eslint' version
107
98
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
108
99
  'no-implied-eval': 'off',
109
100
  'no-new-func': 'off',
110
101
  '@typescript-eslint/no-implied-eval': best_practices_1.default.rules['no-implied-eval'],
111
- // Replace Airbnb 'no-loss-of-precision' rule with '@typescript-eslint' version
112
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loss-of-precision.md
113
- 'no-loss-of-precision': 'off',
114
- '@typescript-eslint/no-loss-of-precision': errors_1.default.rules['no-loss-of-precision'],
115
102
  // Replace Airbnb 'no-loop-func' rule with '@typescript-eslint' version
116
103
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
117
104
  'no-loop-func': 'off',
@@ -131,11 +118,11 @@ exports.default = {
131
118
  // Replace Airbnb 'space-before-blocks' rule with '@typescript-eslint' version
132
119
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-blocks.md
133
120
  'space-before-blocks': 'off',
134
- '@typescript-eslint/space-before-blocks': style_1.default.rules['space-before-blocks'],
121
+ '@typescript-eslint/space-before-blocks': stylistic_1.default.rules['space-before-blocks'],
135
122
  // Replace Airbnb 'no-throw-literal' rule with '@typescript-eslint' version
136
123
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
137
124
  'no-throw-literal': 'off',
138
- '@typescript-eslint/no-throw-literal': best_practices_1.default.rules['no-throw-literal'],
125
+ '@typescript-eslint/only-throw-error': best_practices_1.default.rules['no-throw-literal'],
139
126
  // Replace Airbnb 'no-unused-expressions' rule with '@typescript-eslint' version
140
127
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
141
128
  'no-unused-expressions': 'off',
@@ -155,30 +142,31 @@ exports.default = {
155
142
  // Replace Airbnb 'quotes' rule with '@typescript-eslint' version
156
143
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
157
144
  quotes: 'off',
158
- '@typescript-eslint/quotes': style_1.default.rules.quotes,
145
+ '@typescript-eslint/quotes': stylistic_1.default.rules.quotes,
159
146
  // Replace Airbnb 'semi' rule with '@typescript-eslint' version
160
147
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
161
148
  semi: 'off',
162
- '@typescript-eslint/semi': style_1.default.rules.semi,
149
+ '@typescript-eslint/semi': stylistic_1.default.rules.semi,
163
150
  // Replace Airbnb 'space-before-function-paren' rule with '@typescript-eslint' version
164
151
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
165
152
  'space-before-function-paren': 'off',
166
- '@typescript-eslint/space-before-function-paren': style_1.default.rules['space-before-function-paren'],
153
+ '@typescript-eslint/space-before-function-paren': stylistic_1.default.rules['space-before-function-paren'],
167
154
  // Replace Airbnb 'require-await' rule with '@typescript-eslint' version
168
155
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
169
156
  'require-await': 'off',
170
157
  '@typescript-eslint/require-await': best_practices_1.default.rules['require-await'],
171
158
  // Replace Airbnb 'no-return-await' rule with '@typescript-eslint' version
172
159
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
173
- 'no-return-await': 'off',
174
- '@typescript-eslint/return-await': [best_practices_1.default.rules['no-return-await'], 'in-try-catch'],
160
+ // Its Base rule is deprecated
161
+ '@typescript-eslint/return-await': ['error', 'in-try-catch'],
175
162
  // Replace Airbnb 'space-infix-ops' rule with '@typescript-eslint' version
176
163
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
177
164
  'space-infix-ops': 'off',
178
- '@typescript-eslint/space-infix-ops': style_1.default.rules['space-infix-ops'],
165
+ '@typescript-eslint/space-infix-ops': stylistic_1.default.rules['space-infix-ops'],
179
166
  // Replace Airbnb 'object-curly-spacing' rule with '@typescript-eslint' version
180
167
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/object-curly-spacing.md
181
168
  'object-curly-spacing': 'off',
182
- '@typescript-eslint/object-curly-spacing': style_1.default.rules['object-curly-spacing'],
169
+ '@typescript-eslint/object-curly-spacing': stylistic_1.default.rules['object-curly-spacing'],
183
170
  },
184
171
  };
172
+ exports.default = typescriptEslintRules;
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../../utils");
4
- const getDevDepsList_1 = require("../../helpers/getDevDepsList");
5
6
  const eslint_import_resolver_typescript_1 = require("eslint-import-resolver-typescript");
7
+ const getDevDepsList_1 = __importDefault(require("../../helpers/getDevDepsList"));
8
+ const utils_1 = require("../../utils");
6
9
  /**
7
10
  * @see https://github.com/un-ts/eslint-plugin-import-x/blob/master/src/config/typescript.ts
8
11
  */
9
- exports.default = {
12
+ const typescriptImportsRules = {
10
13
  name: 'airbnb/config/typescript/import-x',
11
14
  settings: {
12
15
  // Apply special parsing for TypeScript files
@@ -39,7 +42,7 @@ exports.default = {
39
42
  'import-x/no-extraneous-dependencies': [
40
43
  'error',
41
44
  {
42
- devDependencies: (0, getDevDepsList_1.getDevDepsList)(utils_1.tsExtensions.join(',')),
45
+ devDependencies: (0, getDevDepsList_1.default)([...utils_1.jsExtensions, ...utils_1.tsExtensions].map((ext) => ext.slice(1)).join(',')),
43
46
  optionalDependencies: false,
44
47
  peerDependencies: true,
45
48
  bundledDependencies: true,
@@ -52,3 +55,4 @@ exports.default = {
52
55
  'import-x/no-named-as-default-member': 'off',
53
56
  },
54
57
  };
58
+ exports.default = typescriptImportsRules;
@@ -4,13 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const confusing_browser_globals_1 = __importDefault(require("confusing-browser-globals"));
7
- exports.default = {
7
+ const variablesRules = {
8
8
  name: 'airbnb/config/variables',
9
9
  rules: {
10
10
  // enforce or disallow variable initializations at definition
11
11
  'init-declarations': 'off',
12
- // disallow the catch clause parameter name being the same as a variable in the outer scope
13
- 'no-catch-shadow': 'off',
14
12
  // disallow deletion of variables
15
13
  'no-delete-var': 'error',
16
14
  // disallow labels that share a name with a variable
@@ -63,3 +61,4 @@ exports.default = {
63
61
  ],
64
62
  },
65
63
  };
64
+ exports.default = variablesRules;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-airbnb-extended",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "description": "Eslint Airbnb Config Extended",
5
5
  "keywords": [
6
6
  "eslint",
@@ -29,7 +29,7 @@
29
29
  "author": "Nisharg Shah <nishargshah3101@gmail.com>",
30
30
  "type": "commonjs",
31
31
  "main": "dist/index.js",
32
- "types": "dist/index.d.ts",
32
+ "types": "dist/@types/index.d.ts",
33
33
  "dependencies": {
34
34
  "confusing-browser-globals": "^1.0.11",
35
35
  "globals": "^16.0.0"
@@ -77,7 +77,7 @@
77
77
  }
78
78
  },
79
79
  "scripts": {
80
- "build": "tsc",
80
+ "build": "tsc -b",
81
81
  "postbuild": "tsc-alias",
82
82
  "typecheck": "tsc --noEmit"
83
83
  }