@tuomashatakka/eslint-config 2.2.0 → 2.2.2
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.
- package/eslint.config.mjs +7 -1
- package/index.mjs +18 -1
- package/package.json +1 -1
- package/rules.mjs +20 -12
package/eslint.config.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import stylistic from '@stylistic/eslint-plugin'
|
|
|
3
3
|
import tsplugin from '@typescript-eslint/eslint-plugin'
|
|
4
4
|
import importPlugin from 'eslint-plugin-import'
|
|
5
5
|
import react from 'eslint-plugin-react'
|
|
6
|
+
import globals from 'globals'
|
|
6
7
|
import tseslint from 'typescript-eslint'
|
|
7
8
|
|
|
8
9
|
import rules from './rules.mjs'
|
|
@@ -27,9 +28,14 @@ const config = tseslint.config(
|
|
|
27
28
|
jsx: true,
|
|
28
29
|
},
|
|
29
30
|
},
|
|
31
|
+
globals: {
|
|
32
|
+
...globals.browser,
|
|
33
|
+
...globals.node,
|
|
34
|
+
}
|
|
30
35
|
},
|
|
31
36
|
settings: {
|
|
32
|
-
'import/
|
|
37
|
+
'import/internal-regex': '^@/(.+)',
|
|
38
|
+
'import/resolver': {
|
|
33
39
|
node: {
|
|
34
40
|
extensions: [ '.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs' ],
|
|
35
41
|
},
|
package/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import globals from 'globals'
|
|
1
2
|
import tseslint from 'typescript-eslint'
|
|
2
3
|
|
|
3
4
|
import config from './eslint.config.mjs'
|
|
@@ -9,7 +10,23 @@ const configType = tseslint.configs.base
|
|
|
9
10
|
* @name config
|
|
10
11
|
* @type {typeof configType}
|
|
11
12
|
*/
|
|
12
|
-
export default
|
|
13
|
+
export default [
|
|
14
|
+
...config,
|
|
15
|
+
{
|
|
16
|
+
files: [ '**/*.{js,jsx,mjs,cjs,ts,tsx}' ],
|
|
17
|
+
languageOptions: {
|
|
18
|
+
ecmaVersion: 'latest',
|
|
19
|
+
sourceType: 'module',
|
|
20
|
+
parserOptions: {
|
|
21
|
+
ecmaFeatures: {
|
|
22
|
+
jsx: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
globals: {
|
|
26
|
+
...globals.browser,
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
}]
|
|
13
30
|
|
|
14
31
|
export {
|
|
15
32
|
config,
|
package/package.json
CHANGED
package/rules.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @exports {import("eslint/rules").ESLintRules} rules
|
|
3
3
|
* @type {import("@eslint/core").RulesConfig}
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export const rules = {
|
|
6
7
|
|
|
7
8
|
// '@next/next/no-styled-jsx-in-document': [ 'error' ],
|
|
@@ -26,22 +27,18 @@ export const rules = {
|
|
|
26
27
|
'import/prefer-default-export': [ 'error' ],
|
|
27
28
|
'import/no-mutable-exports': [ 'error' ],
|
|
28
29
|
'import/order': [ 'warn', {
|
|
29
|
-
'groups': [ 'builtin', 'type', 'external', [ 'parent', 'sibling', 'index' ], 'internal', 'object' ],
|
|
30
|
+
'groups': [ 'builtin', 'type', 'external', [ 'parent', 'sibling', 'index' ], [ 'internal', 'object' ]],
|
|
30
31
|
'alphabetize': { order: 'asc', caseInsensitive: true },
|
|
31
32
|
'distinctGroup': true,
|
|
32
33
|
'warnOnUnassignedImports': true,
|
|
33
34
|
'newlines-between': 'always',
|
|
34
35
|
'pathGroups': [
|
|
35
|
-
{ group: 'internal', pattern: '**/*.css'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{ group: 'parent', pattern: '../**' },
|
|
39
|
-
{ group: 'sibling', pattern: './**' }]}],
|
|
36
|
+
{ group: 'internal', pattern: '**/*.s?css' }
|
|
37
|
+
]}
|
|
38
|
+
],
|
|
40
39
|
|
|
41
40
|
// Typescript
|
|
42
|
-
'@
|
|
43
|
-
'@typescript-eslint/no-unused-vars': [ 'warn' ],
|
|
44
|
-
'@typescript-eslint/no-explicit-any': [ 'warn' ],
|
|
41
|
+
'@stylistic/ban-ts-comment': [ 'off', 'allow-single-line' ],
|
|
45
42
|
|
|
46
43
|
// Enforced practices (enforce functional and orthogonal code)
|
|
47
44
|
'complexity': [ 'warn', { max: 11 }],
|
|
@@ -122,7 +119,6 @@ export const rules = {
|
|
|
122
119
|
'@stylistic/jsx-newline': [ 'warn', { prevent: true, allowMultilines: true }],
|
|
123
120
|
'@stylistic/jsx-props-no-multi-spaces': [ 'warn' ],
|
|
124
121
|
'@stylistic/jsx-equals-spacing': [ 'warn', 'never' ],
|
|
125
|
-
'@stylistic/jsx-indent-props': [ 'warn', 2 ],
|
|
126
122
|
'@stylistic/jsx-max-props-per-line': [ 'warn', { maximum: 1, when: 'multiline' }],
|
|
127
123
|
'@stylistic/jsx-self-closing-comp': [ 'warn', { component: true, html: true }],
|
|
128
124
|
'@stylistic/jsx-one-expression-per-line': [ 'warn', { allow: 'single-child' }],
|
|
@@ -141,8 +137,6 @@ export const rules = {
|
|
|
141
137
|
'react/jsx-closing-tag-location': [ 'warn', 'line-aligned' ],
|
|
142
138
|
'react/jsx-equals-spacing': [ 'warn', 'never' ],
|
|
143
139
|
'react/jsx-first-prop-new-line': [ 'warn', 'multiline' ],
|
|
144
|
-
'react/jsx-indent': [ 'warn', 2, { checkAttributes: true, indentLogicalExpressions: true }],
|
|
145
|
-
'react/jsx-indent-props': [ 'warn', 2 ],
|
|
146
140
|
'react/jsx-max-props-per-line': [ 'warn', { maximum: 1, when: 'multiline' }],
|
|
147
141
|
'react/jsx-no-constructed-context-values': [ 'warn' ],
|
|
148
142
|
'react/jsx-no-script-url': [ 'warn' ],
|
|
@@ -154,6 +148,10 @@ export const rules = {
|
|
|
154
148
|
'react/jsx-curly-spacing': [ 'warn', { when: 'never', children: true }],
|
|
155
149
|
'react/display-name': [ 'warn', { checkContextObjects: true }],
|
|
156
150
|
|
|
151
|
+
'import/prefer-default-export': 'off',
|
|
152
|
+
'@stylistic/jsx-indent-props': [ 'warn', { indentMode: 2, ignoreTernaryOperator: true }],
|
|
153
|
+
'@stylistic/indent': [ 'warn', 2, { offsetTernaryExpressions: false, flatTernaryExpressions: true }],
|
|
154
|
+
|
|
157
155
|
// Block padding
|
|
158
156
|
'@stylistic/no-multi-spaces': [ 'warn', { exceptions: { Property: true, TSTypeAnnotation: true, VariableDeclarator: true, ObjectExpression: false }}],
|
|
159
157
|
'@stylistic/spaced-comment': [ 'warn', 'always', { markers: [ '/' ]}],
|
|
@@ -183,6 +181,16 @@ export const rules = {
|
|
|
183
181
|
{ blankLine: 'any',
|
|
184
182
|
prev: [ 'multiline-expression', 'function', 'block-like', 'block' ],
|
|
185
183
|
next: [ 'multiline-expression', 'function', 'block-like', 'block' ]}],
|
|
184
|
+
|
|
185
|
+
'@stylistic/jsx-closing-bracket-location': [ 0 ],
|
|
186
|
+
'@stylistic/jsx-one-expression-per-line': [ 'warn', { allow: 'non-jsx' }],
|
|
187
|
+
'react/jsx-one-expression-per-line': [ 'warn', { allow: 'non-jsx' }],
|
|
188
|
+
'react/jsx-closing-bracket-location': [ 0 ],
|
|
189
|
+
'react/jsx-curly-spacing': [ 0 ],
|
|
190
|
+
'@stylistic/jsx-curly-spacing': [ 'warn', { spacing: { objectLiterals: 'always' }}],
|
|
191
|
+
'@stylistic/implicit-arrow-linebreak': [ 0 ],
|
|
192
|
+
'@stylistic/arrow-parens': [ 1, 'as-needed', { requireForBlockBody: true }],
|
|
193
|
+
'@stylistic/space-before-function-paren': [ 1, 'always' ]
|
|
186
194
|
}
|
|
187
195
|
|
|
188
196
|
export default rules
|