eslint-config-entva-typescript-base 2.18.0 → 2.18.1

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 (2) hide show
  1. package/index.js +180 -176
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ignoreRule, mainRule, testRule } from 'eslint-config-entva-base';
1
+ import { ignoreRule, mainRule as baseMainRule, testRule as baseTestRule } from 'eslint-config-entva-base';
2
2
  import importPlugin from 'eslint-plugin-import';
3
3
  import globals from 'globals';
4
4
  import typescriptEslint from '@typescript-eslint/eslint-plugin';
@@ -12,196 +12,200 @@ const getOverrides = (base, rules, overridePrefix) => rules.reduce((acc, rule) =
12
12
  return acc;
13
13
  }, {});
14
14
 
15
- export default [
16
- ignoreRule,
17
- mainRule,
18
- {
19
- files: ['**/*.{ts,tsx}'],
20
- plugins: {
21
- import: importPlugin,
22
- '@typescript-eslint': typescriptEslint,
23
- '@stylistic/ts': stylisticTs,
24
- },
15
+ export const mainRule = {
16
+ files: ['**/*.{ts,tsx}'],
17
+ plugins: {
18
+ import: importPlugin,
19
+ '@typescript-eslint': typescriptEslint,
20
+ '@stylistic/ts': stylisticTs,
21
+ },
25
22
 
26
- languageOptions: {
27
- globals: {
28
- ...globals.browser,
29
- ...globals.node,
30
- },
23
+ languageOptions: {
24
+ globals: {
25
+ ...globals.browser,
26
+ ...globals.node,
27
+ },
31
28
 
32
- parser: tsParser,
33
- ecmaVersion: 'latest',
34
- sourceType: 'module',
29
+ parser: tsParser,
30
+ ecmaVersion: 'latest',
31
+ sourceType: 'module',
35
32
 
36
- parserOptions: {
37
- parser: '@typescript-eslint/parser',
38
- project: './tsconfig.json',
33
+ parserOptions: {
34
+ parser: '@typescript-eslint/parser',
35
+ project: './tsconfig.json',
39
36
 
40
- ecmaFeatures: {
41
- generators: false,
42
- objectLiteralDuplicateProperties: false,
43
- jsx: true,
44
- },
37
+ ecmaFeatures: {
38
+ generators: false,
39
+ objectLiteralDuplicateProperties: false,
40
+ jsx: true,
45
41
  },
46
42
  },
43
+ },
47
44
 
48
- settings: {
49
- 'import/parsers': {
50
- '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
51
- },
45
+ settings: {
46
+ 'import/parsers': {
47
+ '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
48
+ },
52
49
 
53
- 'import/resolver': {
54
- node: {
55
- extensions: ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
56
- },
50
+ 'import/resolver': {
51
+ node: {
52
+ extensions: ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
57
53
  },
54
+ },
58
55
 
59
- 'import/extensions': ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
60
- 'import/external-module-folders': ['node_modules', 'node_modules/@types'],
61
- 'import/core-modules': [],
62
- 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
63
-
64
- react: {
65
- pragma: 'React',
66
- version: 'detect',
67
- },
56
+ 'import/extensions': ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
57
+ 'import/external-module-folders': ['node_modules', 'node_modules/@types'],
58
+ 'import/core-modules': [],
59
+ 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
68
60
 
69
- propWrapperFunctions: ['forbidExtraProps', 'exact', 'Object.freeze'],
61
+ react: {
62
+ pragma: 'React',
63
+ version: 'detect',
70
64
  },
71
65
 
72
- rules: {
73
- ...mainRule.rules,
74
- ...getOverrides(
75
- mainRule.rules,
76
- [
77
- 'no-array-constructor',
78
- 'no-useless-constructor',
79
- 'no-empty-function',
80
- 'no-dupe-class-members',
81
- 'default-param-last',
82
- 'dot-notation',
83
- 'naming-convention',
84
- 'no-shadow',
85
- 'no-unused-vars',
86
- ],
87
- '@typescript-eslint',
88
- ),
89
- ...getOverrides(
90
- mainRule.rules,
91
- [
92
- 'space-before-function-paren',
93
- 'lines-between-class-members',
94
- 'space-before-blocks',
95
- 'brace-style',
96
- 'indent',
97
- 'keyword-spacing',
98
- 'space-infix-ops',
99
- 'comma-spacing',
100
- 'comma-dangle',
101
- 'object-curly-spacing',
102
- 'quotes',
103
- ],
104
- '@stylistic/ts',
105
- ),
106
-
107
- '@typescript-eslint/no-implied-eval': ['error'],
108
- '@typescript-eslint/no-loss-of-precision': ['error'],
109
- '@typescript-eslint/no-loop-func': ['error'],
110
- '@typescript-eslint/no-magic-numbers': ['off', {
111
- ignore: [],
112
- ignoreArrayIndexes: true,
113
- enforceConst: true,
114
- detectObjects: false,
115
- }],
116
-
117
- '@typescript-eslint/no-redeclare': ['error'],
118
- '@typescript-eslint/no-unused-expressions': ['error', {
119
- allowShortCircuit: false,
120
- allowTernary: false,
121
- allowTaggedTemplates: false,
122
- enforceForJSX: false,
123
- }],
124
-
125
- '@typescript-eslint/no-use-before-define': ['error', {
126
- functions: true,
127
- classes: true,
128
- variables: true,
129
- }],
130
-
131
- '@typescript-eslint/require-await': ['off'],
132
- '@typescript-eslint/return-await': ['error', 'in-try-catch'],
133
-
134
- '@typescript-eslint/no-explicit-any': ['error', {
135
- ignoreRestArgs: true,
136
- }],
137
-
138
- '@typescript-eslint/naming-convention': ['error', {
139
- selector: 'variable',
140
- format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
141
- leadingUnderscore: 'allowSingleOrDouble',
142
- }, {
143
- selector: 'function',
144
- format: ['camelCase', 'PascalCase'],
145
- leadingUnderscore: 'allowSingleOrDouble',
146
- }, {
147
- selector: 'typeLike',
148
- format: ['PascalCase'],
149
- leadingUnderscore: 'allowSingleOrDouble',
150
- }],
151
-
152
- '@typescript-eslint/no-extra-parens': ['off', 'all', {
153
- conditionalAssign: true,
154
- nestedBinaryExpressions: false,
155
- returnAssign: false,
156
- ignoreJSX: 'all',
157
- enforceForArrowConditionals: false,
158
- }],
159
-
160
- '@stylistic/ts/member-delimiter-style': ['error', {
161
- multiline: {
162
- delimiter: 'comma',
163
- },
164
-
165
- singleline: {
166
- delimiter: 'comma',
167
- },
168
- }],
169
- '@stylistic/ts/func-call-spacing': ['error', 'never'],
170
- '@stylistic/ts/no-extra-semi': ['error'],
171
- '@stylistic/ts/comma-dangle': ['error', {
172
- arrays: 'always-multiline',
173
- objects: 'always-multiline',
174
- imports: 'always-multiline',
175
- exports: 'always-multiline',
176
- functions: 'always-multiline',
177
- enums: 'always-multiline',
178
- generics: 'always-multiline',
179
- tuples: 'always-multiline',
180
- }],
181
- },
66
+ propWrapperFunctions: ['forbidExtraProps', 'exact', 'Object.freeze'],
182
67
  },
183
- testRule,
184
- {
185
- files: [
186
- '**/*.test.ts',
187
- '**/*.test.tsx',
188
- '**/*.spec.ts',
189
- '**/*.spec.tsx',
190
- '**/__tests__/**',
191
- ],
192
- languageOptions: {
193
- globals: {
194
- ...globals.jest,
68
+
69
+ rules: {
70
+ ...baseMainRule.rules,
71
+ ...getOverrides(
72
+ baseMainRule.rules,
73
+ [
74
+ 'no-array-constructor',
75
+ 'no-useless-constructor',
76
+ 'no-empty-function',
77
+ 'no-dupe-class-members',
78
+ 'default-param-last',
79
+ 'dot-notation',
80
+ 'naming-convention',
81
+ 'no-shadow',
82
+ 'no-unused-vars',
83
+ ],
84
+ '@typescript-eslint',
85
+ ),
86
+ ...getOverrides(
87
+ baseMainRule.rules,
88
+ [
89
+ 'space-before-function-paren',
90
+ 'lines-between-class-members',
91
+ 'space-before-blocks',
92
+ 'brace-style',
93
+ 'indent',
94
+ 'keyword-spacing',
95
+ 'space-infix-ops',
96
+ 'comma-spacing',
97
+ 'comma-dangle',
98
+ 'object-curly-spacing',
99
+ 'quotes',
100
+ ],
101
+ '@stylistic/ts',
102
+ ),
103
+
104
+ '@typescript-eslint/no-implied-eval': ['error'],
105
+ '@typescript-eslint/no-loss-of-precision': ['error'],
106
+ '@typescript-eslint/no-loop-func': ['error'],
107
+ '@typescript-eslint/no-magic-numbers': ['off', {
108
+ ignore: [],
109
+ ignoreArrayIndexes: true,
110
+ enforceConst: true,
111
+ detectObjects: false,
112
+ }],
113
+
114
+ '@typescript-eslint/no-redeclare': ['error'],
115
+ '@typescript-eslint/no-unused-expressions': ['error', {
116
+ allowShortCircuit: false,
117
+ allowTernary: false,
118
+ allowTaggedTemplates: false,
119
+ enforceForJSX: false,
120
+ }],
121
+
122
+ '@typescript-eslint/no-use-before-define': ['error', {
123
+ functions: true,
124
+ classes: true,
125
+ variables: true,
126
+ }],
127
+
128
+ '@typescript-eslint/require-await': ['off'],
129
+ '@typescript-eslint/return-await': ['error', 'in-try-catch'],
130
+
131
+ '@typescript-eslint/no-explicit-any': ['error', {
132
+ ignoreRestArgs: true,
133
+ }],
134
+
135
+ '@typescript-eslint/naming-convention': ['error', {
136
+ selector: 'variable',
137
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
138
+ leadingUnderscore: 'allowSingleOrDouble',
139
+ }, {
140
+ selector: 'function',
141
+ format: ['camelCase', 'PascalCase'],
142
+ leadingUnderscore: 'allowSingleOrDouble',
143
+ }, {
144
+ selector: 'typeLike',
145
+ format: ['PascalCase'],
146
+ leadingUnderscore: 'allowSingleOrDouble',
147
+ }],
148
+
149
+ '@typescript-eslint/no-extra-parens': ['off', 'all', {
150
+ conditionalAssign: true,
151
+ nestedBinaryExpressions: false,
152
+ returnAssign: false,
153
+ ignoreJSX: 'all',
154
+ enforceForArrowConditionals: false,
155
+ }],
156
+
157
+ '@stylistic/ts/member-delimiter-style': ['error', {
158
+ multiline: {
159
+ delimiter: 'comma',
195
160
  },
196
- },
197
- rules: {
198
- ...getOverrides(
199
- testRule.rules,
200
- [
201
- 'no-unused-vars',
202
- ],
203
- '@typescript-eslint',
204
- ),
161
+
162
+ singleline: {
163
+ delimiter: 'comma',
164
+ },
165
+ }],
166
+ '@stylistic/ts/func-call-spacing': ['error', 'never'],
167
+ '@stylistic/ts/no-extra-semi': ['error'],
168
+ '@stylistic/ts/comma-dangle': ['error', {
169
+ arrays: 'always-multiline',
170
+ objects: 'always-multiline',
171
+ imports: 'always-multiline',
172
+ exports: 'always-multiline',
173
+ functions: 'always-multiline',
174
+ enums: 'always-multiline',
175
+ generics: 'always-multiline',
176
+ tuples: 'always-multiline',
177
+ }],
178
+ },
179
+ };
180
+
181
+ export const testRule = {
182
+ files: [
183
+ '**/*.test.ts',
184
+ '**/*.test.tsx',
185
+ '**/*.spec.ts',
186
+ '**/*.spec.tsx',
187
+ '**/__tests__/**',
188
+ ],
189
+ languageOptions: {
190
+ globals: {
191
+ ...globals.jest,
205
192
  },
206
193
  },
194
+ rules: {
195
+ ...getOverrides(
196
+ baseTestRule.rules,
197
+ [
198
+ 'no-unused-vars',
199
+ ],
200
+ '@typescript-eslint',
201
+ ),
202
+ },
203
+ };
204
+
205
+ export default [
206
+ ignoreRule,
207
+ baseMainRule,
208
+ mainRule,
209
+ baseTestRule,
210
+ testRule,
207
211
  ];
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "url": "https://github.com/entva/styleguide"
10
10
  },
11
11
  "bugs": "https://github.com/entva/styleguide/issues",
12
- "version": "2.18.0",
12
+ "version": "2.18.1",
13
13
  "keywords": [
14
14
  "linter",
15
15
  "config",