@mkaradeniz/eslint-config 4.0.16 → 4.0.18
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/package.json +8 -4
- package/rules/baseRules.mjs +10 -7
- package/rules/reactRules.mjs +14 -10
- package/rules/typescriptRules.mjs +12 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkaradeniz/eslint-config",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.18",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"base.mjs",
|
|
@@ -38,18 +38,22 @@
|
|
|
38
38
|
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
39
39
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
40
40
|
"eslint-plugin-tsdoc": "^0.5.0",
|
|
41
|
-
"eslint-plugin-turbo": "2.7.
|
|
41
|
+
"eslint-plugin-turbo": "2.7.3",
|
|
42
42
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
43
43
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
44
44
|
"globals": "^17.0.0",
|
|
45
|
-
"typescript-eslint": "^8.
|
|
45
|
+
"typescript-eslint": "^8.52.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@mkaradeniz/prettier-config": "^4.0.
|
|
48
|
+
"@mkaradeniz/prettier-config": "^4.0.6",
|
|
49
|
+
"eslint": "^9.39.2",
|
|
49
50
|
"husky": "^9.1.7",
|
|
50
51
|
"lint-staged": "^16.2.7",
|
|
51
52
|
"prettier": "^3.7.4",
|
|
52
53
|
"rimraf": "^6.1.2",
|
|
53
54
|
"typescript": "^5.9.3"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"eslint": "^9.39.2"
|
|
54
58
|
}
|
|
55
59
|
}
|
package/rules/baseRules.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const baseRules = {
|
|
2
2
|
rules: {
|
|
3
|
-
'array-callback-return': ['warn', { allowImplicit: true,
|
|
3
|
+
'array-callback-return': ['warn', { allowImplicit: true, allowVoid: false, checkForEach: false }],
|
|
4
4
|
'block-scoped-var': ['warn'],
|
|
5
5
|
camelcase: [
|
|
6
6
|
'warn',
|
|
7
|
-
{ allow: ['^UNSAFE_'], ignoreDestructuring: false,
|
|
7
|
+
{ allow: ['^UNSAFE_'], ignoreDestructuring: false, ignoreGlobals: false, ignoreImports: false, properties: 'never' },
|
|
8
8
|
],
|
|
9
9
|
curly: ['warn', 'all'],
|
|
10
10
|
'default-case-last': ['warn'],
|
|
@@ -44,7 +44,7 @@ export const baseRules = {
|
|
|
44
44
|
'no-extra-label': ['warn'],
|
|
45
45
|
'no-fallthrough': ['off'],
|
|
46
46
|
'no-global-assign': ['warn'],
|
|
47
|
-
'no-implicit-coercion': ['warn', { boolean: true,
|
|
47
|
+
'no-implicit-coercion': ['warn', { boolean: true, disallowTemplateShorthand: false, number: true, string: true }],
|
|
48
48
|
'no-inner-declarations': ['warn'],
|
|
49
49
|
'no-invalid-regexp': ['warn'],
|
|
50
50
|
'no-irregular-whitespace': ['warn'],
|
|
@@ -69,14 +69,17 @@ export const baseRules = {
|
|
|
69
69
|
'no-regex-spaces': ['warn'],
|
|
70
70
|
'no-restricted-syntax': [
|
|
71
71
|
'warn',
|
|
72
|
-
{ selector: 'SwitchCase > *.consequent[type!="BlockStatement"]', message: 'Switch cases without blocks are disallowed.' },
|
|
73
72
|
{
|
|
74
|
-
|
|
73
|
+
message: 'Switch cases without blocks are disallowed.',
|
|
74
|
+
selector: 'SwitchCase > *.consequent[type!="BlockStatement"]',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
75
77
|
message: 'Use .toSorted() instead of .sort() to avoid mutating the original array.',
|
|
78
|
+
selector: 'CallExpression[callee.property.name="sort"]',
|
|
76
79
|
},
|
|
77
80
|
{
|
|
78
|
-
selector: 'CallExpression[callee.property.name="reverse"]',
|
|
79
81
|
message: 'Use .toReversed() instead of .reverse() to avoid mutating the original array.',
|
|
82
|
+
selector: 'CallExpression[callee.property.name="reverse"]',
|
|
80
83
|
},
|
|
81
84
|
],
|
|
82
85
|
'no-return-assign': ['warn'],
|
|
@@ -120,6 +123,7 @@ export const baseRules = {
|
|
|
120
123
|
'prefer-spread': ['warn'],
|
|
121
124
|
'prefer-template': ['warn'],
|
|
122
125
|
'require-yield': ['warn'],
|
|
126
|
+
'sort-keys': ['warn', 'asc', { allowLineSeparatedGroups: true, caseSensitive: true, minKeys: 2, natural: true }],
|
|
123
127
|
'symbol-description': ['warn'],
|
|
124
128
|
'use-isnan': ['warn'],
|
|
125
129
|
'valid-typeof': ['warn'],
|
|
@@ -161,6 +165,5 @@ export const baseRules = {
|
|
|
161
165
|
],
|
|
162
166
|
'unicorn/number-literal-case': ['warn'],
|
|
163
167
|
'unicorn/prefer-node-protocol': ['warn'],
|
|
164
|
-
'sort-keys': ['warn', 'asc', { allowLineSeparatedGroups: true, caseSensitive: true, minKeys: 2, natural: true }],
|
|
165
168
|
},
|
|
166
169
|
};
|
package/rules/reactRules.mjs
CHANGED
|
@@ -5,7 +5,6 @@ export const reactRules = {
|
|
|
5
5
|
{
|
|
6
6
|
paths: [
|
|
7
7
|
{
|
|
8
|
-
name: 'react',
|
|
9
8
|
importNames: [
|
|
10
9
|
'createContext',
|
|
11
10
|
'fordwardRef',
|
|
@@ -29,6 +28,7 @@ export const reactRules = {
|
|
|
29
28
|
],
|
|
30
29
|
message:
|
|
31
30
|
"React built-in hooks & functions should not be important directly. `Import React from 'react'` and then use `React.useBuiltInHook()` || `React.function()`.",
|
|
31
|
+
name: 'react',
|
|
32
32
|
},
|
|
33
33
|
],
|
|
34
34
|
},
|
|
@@ -41,10 +41,11 @@ export const reactRules = {
|
|
|
41
41
|
'react/jsx-curly-brace-presence': ['warn', { children: 'ignore', props: 'never' }],
|
|
42
42
|
'react/jsx-fragments': ['warn'],
|
|
43
43
|
'react/jsx-key': ['warn'],
|
|
44
|
+
'react/jsx-newline': ['warn', { prevent: false }],
|
|
44
45
|
'react/jsx-no-comment-textnodes': ['warn'],
|
|
45
46
|
'react/jsx-no-duplicate-props': ['warn'],
|
|
46
47
|
'react/jsx-no-leaked-render': ['warn'],
|
|
47
|
-
'react/jsx-no-target-blank': ['warn', { allowReferrer: true,
|
|
48
|
+
'react/jsx-no-target-blank': ['warn', { allowReferrer: true, forms: false, links: true }],
|
|
48
49
|
'react/jsx-no-undef': ['warn'],
|
|
49
50
|
'react/jsx-no-useless-fragment': ['warn', { allowExpressions: true }],
|
|
50
51
|
'react/jsx-pascal-case': ['warn'],
|
|
@@ -64,14 +65,17 @@ export const reactRules = {
|
|
|
64
65
|
'react/no-unstable-nested-components': ['warn'],
|
|
65
66
|
'react/require-render-return': ['warn'],
|
|
66
67
|
'react/self-closing-comp': ['warn'],
|
|
68
|
+
|
|
67
69
|
// react-hooks
|
|
68
|
-
'react-hooks/rules-of-hooks': ['warn'],
|
|
69
70
|
'react-hooks/exhaustive-deps': ['warn'],
|
|
71
|
+
'react-hooks/rules-of-hooks': ['warn'],
|
|
72
|
+
|
|
70
73
|
// @stylistic/jsx
|
|
71
74
|
/**
|
|
72
75
|
* https://eslint.style/rules/default/jsx-newline
|
|
73
76
|
*/
|
|
74
|
-
'@stylistic/jsx-pascal-case': ['warn', { allowAllCaps: false,
|
|
77
|
+
'@stylistic/jsx-pascal-case': ['warn', { allowAllCaps: false, allowLeadingUnderscore: false, allowNamespace: true }],
|
|
78
|
+
|
|
75
79
|
// jsx-a11y
|
|
76
80
|
'jsx-a11y/alt-text': ['warn'],
|
|
77
81
|
'jsx-a11y/anchor-has-content': ['warn'],
|
|
@@ -105,14 +109,14 @@ export const reactRules = {
|
|
|
105
109
|
'jsx-a11y/no-access-key': ['warn'],
|
|
106
110
|
'jsx-a11y/no-autofocus': ['warn'],
|
|
107
111
|
'jsx-a11y/no-distracting-elements': ['warn'],
|
|
108
|
-
'jsx-a11y/no-interactive-element-to-noninteractive-role': ['warn', {
|
|
112
|
+
'jsx-a11y/no-interactive-element-to-noninteractive-role': ['warn', { canvas: ['img'], tr: ['none', 'presentation'] }],
|
|
109
113
|
'jsx-a11y/no-noninteractive-element-interactions': [
|
|
110
114
|
'warn',
|
|
111
115
|
{
|
|
112
|
-
handlers: ['onClick', 'onError', 'onLoad', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
113
116
|
alert: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
|
|
114
117
|
body: ['onError', 'onLoad'],
|
|
115
118
|
dialog: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
|
|
119
|
+
handlers: ['onClick', 'onError', 'onLoad', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
116
120
|
iframe: ['onError', 'onLoad'],
|
|
117
121
|
img: ['onError', 'onLoad'],
|
|
118
122
|
},
|
|
@@ -120,15 +124,15 @@ export const reactRules = {
|
|
|
120
124
|
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
|
121
125
|
'warn',
|
|
122
126
|
{
|
|
123
|
-
|
|
124
|
-
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
127
|
+
fieldset: ['radiogroup', 'presentation'],
|
|
125
128
|
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
|
129
|
+
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
126
130
|
table: ['grid'],
|
|
127
131
|
td: ['gridcell'],
|
|
128
|
-
|
|
132
|
+
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
129
133
|
},
|
|
130
134
|
],
|
|
131
|
-
'jsx-a11y/no-noninteractive-tabindex': ['warn', {
|
|
135
|
+
'jsx-a11y/no-noninteractive-tabindex': ['warn', { allowExpressionValues: true, roles: ['tabpanel'], tags: [] }],
|
|
132
136
|
'jsx-a11y/no-redundant-roles': ['warn'],
|
|
133
137
|
'jsx-a11y/no-static-element-interactions': [
|
|
134
138
|
'warn',
|
|
@@ -23,6 +23,7 @@ export const typescriptRules = {
|
|
|
23
23
|
'no-unused-expressions': ['off'],
|
|
24
24
|
'no-unused-vars': ['off'],
|
|
25
25
|
'no-useless-constructor': ['off'],
|
|
26
|
+
|
|
26
27
|
// Typescript-specific rules.
|
|
27
28
|
'@typescript-eslint/adjacent-overload-signatures': ['warn'],
|
|
28
29
|
'@typescript-eslint/array-type': ['warn', { default: 'generic' }],
|
|
@@ -33,20 +34,15 @@ export const typescriptRules = {
|
|
|
33
34
|
'@typescript-eslint/consistent-indexed-object-style': ['warn'],
|
|
34
35
|
'@typescript-eslint/consistent-type-assertions': ['warn'],
|
|
35
36
|
'@typescript-eslint/consistent-type-definitions': ['warn', 'type'],
|
|
36
|
-
'@typescript-eslint/consistent-type-imports': ['warn', {
|
|
37
|
+
'@typescript-eslint/consistent-type-imports': ['warn', { fixStyle: 'inline-type-imports', prefer: 'type-imports' }],
|
|
37
38
|
'@typescript-eslint/naming-convention': [
|
|
38
39
|
'warn',
|
|
39
40
|
{
|
|
40
|
-
|
|
41
|
+
filter: { match: false, regex: '^(UNSAFE_|__)' },
|
|
41
42
|
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
42
|
-
|
|
43
|
-
regex: '^(UNSAFE_|__)',
|
|
44
|
-
match: false,
|
|
45
|
-
},
|
|
43
|
+
selector: 'variable',
|
|
46
44
|
},
|
|
47
45
|
{
|
|
48
|
-
selector: 'variable',
|
|
49
|
-
types: ['boolean'],
|
|
50
46
|
format: ['PascalCase', 'camelCase'],
|
|
51
47
|
prefix: [
|
|
52
48
|
'are',
|
|
@@ -68,6 +64,8 @@ export const typescriptRules = {
|
|
|
68
64
|
'were',
|
|
69
65
|
'will',
|
|
70
66
|
],
|
|
67
|
+
selector: 'variable',
|
|
68
|
+
types: ['boolean'],
|
|
71
69
|
},
|
|
72
70
|
],
|
|
73
71
|
'@typescript-eslint/no-array-constructor': ['warn'],
|
|
@@ -114,7 +112,6 @@ export const typescriptRules = {
|
|
|
114
112
|
'warn',
|
|
115
113
|
{
|
|
116
114
|
blankLine: 'always',
|
|
117
|
-
prev: '*',
|
|
118
115
|
next: [
|
|
119
116
|
'block',
|
|
120
117
|
'break',
|
|
@@ -134,16 +131,13 @@ export const typescriptRules = {
|
|
|
134
131
|
'while',
|
|
135
132
|
'with',
|
|
136
133
|
],
|
|
134
|
+
prev: '*',
|
|
137
135
|
},
|
|
138
|
-
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
{ blankLine: 'always', prev: 'directive', next: '*' },
|
|
144
|
-
{ blankLine: 'any', prev: 'directive', next: 'directive' },
|
|
145
|
-
{ blankLine: 'always', prev: '*', next: ['enum', 'interface', 'type'] },
|
|
146
|
-
{ blankLine: 'never', prev: 'function-overload', next: 'function' },
|
|
136
|
+
{ blankLine: 'always', next: '*', prev: ['case', 'default', 'directive'] },
|
|
137
|
+
{ blankLine: 'always', next: '*', prev: 'directive' },
|
|
138
|
+
{ blankLine: 'any', next: 'directive', prev: 'directive' },
|
|
139
|
+
{ blankLine: 'always', next: ['enum', 'interface', 'type'], prev: '*' },
|
|
140
|
+
{ blankLine: 'never', next: 'function', prev: 'function-overload' },
|
|
147
141
|
],
|
|
148
142
|
},
|
|
149
143
|
};
|