eslint-config-entva-typescript-base 1.1.1 → 2.1.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/eslint.config.js +3 -0
  2. package/index.js +262 -48
  3. package/package.json +14 -8
@@ -0,0 +1,3 @@
1
+ import baseConfig from './index.js';
2
+
3
+ export default baseConfig;
package/index.js CHANGED
@@ -1,58 +1,272 @@
1
- module.exports = {
2
- extends: ['entva-base', 'airbnb-typescript/base'],
3
- parserOptions: {
4
- parser: '@typescript-eslint/parser',
5
- project: './tsconfig.json',
1
+ import baseConfig from 'eslint-config-entva-base';
2
+ import importPlugin from 'eslint-plugin-import';
3
+ import globals from 'globals';
4
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
5
+ import tsParser from '@typescript-eslint/parser';
6
+ import stylisticTs from '@stylistic/eslint-plugin-ts';
7
+
8
+ export default [
9
+ ...baseConfig,
10
+ {
11
+ files: [
12
+ '**/*.test.tsx',
13
+ '**/*.spec.tsx',
14
+ ],
15
+ languageOptions: {
16
+ globals: {
17
+ ...globals.jest,
18
+ },
19
+ },
6
20
  },
7
- rules: {
8
- '@typescript-eslint/member-delimiter-style': [
9
- 'error',
10
- {
11
- multiline: { delimiter: 'comma' },
12
- singleline: { delimiter: 'comma' },
21
+ {
22
+ files: ['**/*.{js,mjs,cjs,ts}'],
23
+ plugins: {
24
+ import: importPlugin,
25
+ '@typescript-eslint': typescriptEslint,
26
+ '@stylistic/ts': stylisticTs,
27
+ },
28
+
29
+ languageOptions: {
30
+ globals: {
31
+ ...globals.browser,
32
+ ...globals.node,
13
33
  },
14
- ],
15
- '@typescript-eslint/no-explicit-any': [
16
- 'error',
17
- { ignoreRestArgs: true },
18
- ],
19
- 'import/extensions': [
20
- 'error',
21
- 'ignorePackages',
22
- {
23
- '': 'never',
24
- js: 'never',
25
- jsx: 'never',
26
- ts: 'never',
27
- tsx: 'never',
34
+
35
+ parser: tsParser,
36
+ ecmaVersion: 'latest',
37
+ sourceType: 'module',
38
+
39
+ parserOptions: {
40
+ parser: '@typescript-eslint/parser',
41
+ project: './tsconfig.json',
42
+
43
+ ecmaFeatures: {
44
+ generators: false,
45
+ objectLiteralDuplicateProperties: false,
46
+ },
28
47
  },
29
- ],
30
- '@typescript-eslint/naming-convention': [
31
- 'error',
32
- {
48
+ },
49
+
50
+ settings: {
51
+ 'import/parsers': {
52
+ '@typescript-eslint/parser': ['.ts', '.d.ts'],
53
+ },
54
+
55
+ 'import/resolver': {
56
+ node: {
57
+ extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts'],
58
+ },
59
+ },
60
+
61
+ 'import/extensions': ['.mjs', '.js', '.json', '.ts', '.d.ts'],
62
+ 'import/external-module-folders': ['node_modules', 'node_modules/@types'],
63
+ 'import/core-modules': [],
64
+ 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
65
+ },
66
+
67
+ rules: {
68
+ '@stylistic/ts/member-delimiter-style': ['error', {
69
+ multiline: {
70
+ delimiter: 'comma',
71
+ },
72
+
73
+ singleline: {
74
+ delimiter: 'comma',
75
+ },
76
+ }],
77
+
78
+ '@typescript-eslint/no-explicit-any': ['error', {
79
+ ignoreRestArgs: true,
80
+ }],
81
+
82
+ '@typescript-eslint/naming-convention': ['error', {
33
83
  selector: 'variable',
34
- format: [
35
- 'camelCase',
36
- 'PascalCase',
37
- 'UPPER_CASE',
38
- ],
84
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
39
85
  leadingUnderscore: 'allowSingleOrDouble',
40
- },
41
- {
86
+ }, {
42
87
  selector: 'function',
43
- format: [
44
- 'camelCase',
45
- 'PascalCase',
46
- ],
88
+ format: ['camelCase', 'PascalCase'],
47
89
  leadingUnderscore: 'allowSingleOrDouble',
48
- },
49
- {
90
+ }, {
50
91
  selector: 'typeLike',
51
- format: [
52
- 'PascalCase',
53
- ],
92
+ format: ['PascalCase'],
54
93
  leadingUnderscore: 'allowSingleOrDouble',
55
- },
56
- ],
94
+ }],
95
+
96
+ '@stylistic/ts/brace-style': ['error', '1tbs', {
97
+ allowSingleLine: true,
98
+ }],
99
+
100
+ '@stylistic/ts/comma-dangle': ['error', {
101
+ arrays: 'always-multiline',
102
+ objects: 'always-multiline',
103
+ imports: 'always-multiline',
104
+ exports: 'always-multiline',
105
+ functions: 'always-multiline',
106
+ enums: 'always-multiline',
107
+ generics: 'always-multiline',
108
+ tuples: 'always-multiline',
109
+ }],
110
+
111
+ '@stylistic/ts/comma-spacing': ['error', {
112
+ before: false,
113
+ after: true,
114
+ }],
115
+
116
+ 'default-param-last': 'off',
117
+ '@typescript-eslint/default-param-last': ['error'],
118
+
119
+ '@typescript-eslint/dot-notation': ['error', {
120
+ allowKeywords: true,
121
+ allowPattern: '',
122
+ allowPrivateClassPropertyAccess: false,
123
+ allowProtectedClassPropertyAccess: false,
124
+ allowIndexSignaturePropertyAccess: false,
125
+ }],
126
+
127
+ '@stylistic/ts/func-call-spacing': ['error', 'never'],
128
+
129
+ '@stylistic/ts/indent': ['error', 2, {
130
+ SwitchCase: 1,
131
+ VariableDeclarator: 1,
132
+ outerIIFEBody: 1,
133
+
134
+ FunctionDeclaration: {
135
+ parameters: 1,
136
+ body: 1,
137
+ },
138
+
139
+ FunctionExpression: {
140
+ parameters: 1,
141
+ body: 1,
142
+ },
143
+
144
+ CallExpression: {
145
+ arguments: 1,
146
+ },
147
+
148
+ ArrayExpression: 1,
149
+ ObjectExpression: 1,
150
+ ImportDeclaration: 1,
151
+ flatTernaryExpressions: false,
152
+
153
+ ignoredNodes: [
154
+ 'JSXElement',
155
+ 'JSXElement > *',
156
+ 'JSXAttribute',
157
+ 'JSXIdentifier',
158
+ 'JSXNamespacedName',
159
+ 'JSXMemberExpression',
160
+ 'JSXSpreadAttribute',
161
+ 'JSXExpressionContainer',
162
+ 'JSXOpeningElement',
163
+ 'JSXClosingElement',
164
+ 'JSXFragment',
165
+ 'JSXOpeningFragment',
166
+ 'JSXClosingFragment',
167
+ 'JSXText',
168
+ 'JSXEmptyExpression',
169
+ 'JSXSpreadChild',
170
+ ],
171
+
172
+ ignoreComments: false,
173
+ offsetTernaryExpressions: false,
174
+ }],
175
+
176
+ '@stylistic/ts/keyword-spacing': ['error', {
177
+ before: true,
178
+ after: true,
179
+
180
+ overrides: {
181
+ return: {
182
+ after: true,
183
+ },
184
+
185
+ throw: {
186
+ after: true,
187
+ },
188
+
189
+ case: {
190
+ after: true,
191
+ },
192
+ },
193
+ }],
194
+
195
+ '@stylistic/ts/lines-between-class-members': ['error', 'always', {
196
+ exceptAfterSingleLine: false,
197
+ exceptAfterOverload: true,
198
+ }],
199
+
200
+ '@typescript-eslint/no-array-constructor': ['error'],
201
+ '@typescript-eslint/no-dupe-class-members': ['error'],
202
+
203
+ '@typescript-eslint/no-empty-function': ['error', {
204
+ allow: ['arrowFunctions', 'functions', 'methods'],
205
+ }],
206
+
207
+ '@typescript-eslint/no-extra-parens': ['off', 'all', {
208
+ conditionalAssign: true,
209
+ nestedBinaryExpressions: false,
210
+ returnAssign: false,
211
+ ignoreJSX: 'all',
212
+ enforceForArrowConditionals: false,
213
+ }],
214
+
215
+ '@stylistic/ts/no-extra-semi': ['error'],
216
+ '@typescript-eslint/no-implied-eval': ['error'],
217
+ '@typescript-eslint/no-loss-of-precision': ['error'],
218
+ '@typescript-eslint/no-loop-func': ['error'],
219
+
220
+ '@typescript-eslint/no-magic-numbers': ['off', {
221
+ ignore: [],
222
+ ignoreArrayIndexes: true,
223
+ enforceConst: true,
224
+ detectObjects: false,
225
+ }],
226
+
227
+ '@typescript-eslint/no-redeclare': ['error'],
228
+ '@stylistic/ts/space-before-blocks': ['error'],
229
+
230
+ 'no-shadow': 'off',
231
+ '@typescript-eslint/no-shadow': ['error'],
232
+
233
+ '@typescript-eslint/no-unused-expressions': ['error', {
234
+ allowShortCircuit: false,
235
+ allowTernary: false,
236
+ allowTaggedTemplates: false,
237
+ enforceForJSX: false,
238
+ }],
239
+
240
+ 'no-unused-vars': 'off',
241
+ '@typescript-eslint/no-unused-vars': ['error', {
242
+ vars: 'all',
243
+ args: 'after-used',
244
+ ignoreRestSiblings: true,
245
+ caughtErrors: 'none',
246
+ }],
247
+
248
+ '@typescript-eslint/no-use-before-define': ['error', {
249
+ functions: true,
250
+ classes: true,
251
+ variables: true,
252
+ }],
253
+
254
+ '@typescript-eslint/no-useless-constructor': ['error'],
255
+
256
+ '@stylistic/ts/quotes': ['error', 'single', {
257
+ avoidEscape: true,
258
+ }],
259
+
260
+ '@stylistic/ts/space-before-function-paren': ['error', {
261
+ anonymous: 'always',
262
+ named: 'never',
263
+ asyncArrow: 'always',
264
+ }],
265
+
266
+ '@typescript-eslint/require-await': ['off'],
267
+ '@typescript-eslint/return-await': ['error', 'in-try-catch'],
268
+ '@stylistic/ts/space-infix-ops': ['error'],
269
+ '@stylistic/ts/object-curly-spacing': ['error', 'always'],
270
+ },
57
271
  },
58
- };
272
+ ];
package/package.json CHANGED
@@ -4,15 +4,19 @@
4
4
  "author": "Max Degterev <max@degterev.me>",
5
5
  "license": "MIT",
6
6
  "readmeFilename": "README.md",
7
- "repository": "entva/styleguide",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/entva/styleguide"
10
+ },
8
11
  "bugs": "https://github.com/entva/styleguide/issues",
9
- "version": "1.1.1",
12
+ "version": "2.1.0",
10
13
  "keywords": [
11
14
  "linter",
12
15
  "config",
13
16
  "eslint",
14
17
  "typescript"
15
18
  ],
19
+ "type": "module",
16
20
  "main": "index.js",
17
21
  "scripts": {
18
22
  "reinstall": "rm -rf node_modules package-lock.json && npm install",
@@ -21,15 +25,17 @@
21
25
  "prepublishOnly": "npm test"
22
26
  },
23
27
  "devDependencies": {
24
- "eslint": "^8.57.1"
28
+ "eslint": "^9.16.0"
25
29
  },
26
30
  "dependencies": {
27
- "eslint-config-entva-base": "^1.1.0",
28
- "@typescript-eslint/eslint-plugin": "^7.18.0",
29
- "@typescript-eslint/parser": "^7.18.0",
30
- "eslint-config-airbnb-typescript": "^18.0.0"
31
+ "@stylistic/eslint-plugin-ts": "^2.12.1",
32
+ "@typescript-eslint/eslint-plugin": "^8.18.0",
33
+ "@typescript-eslint/parser": "^8.18.0",
34
+ "eslint-config-entva-base": "^2.3.0",
35
+ "eslint-plugin-import": "^2.31.0",
36
+ "globals": "^15.13.0"
31
37
  },
32
38
  "peerDependencies": {
33
- "eslint": "^8.x.x"
39
+ "eslint": "^9.x.x"
34
40
  }
35
41
  }