@notcodev/eslint 1.3.0 → 1.4.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 +46 -9
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -14,7 +14,10 @@ export function eslint({
14
14
  tanstackRouter,
15
15
  tanstackQuery,
16
16
  ...options
17
- }) {
17
+ } = {}) {
18
+ /**
19
+ * @type {import('@antfu/eslint-config').TypedFlatConfigItem[]}
20
+ */
18
21
  const configs = []
19
22
 
20
23
  if (prettier) {
@@ -45,16 +48,24 @@ export function eslint({
45
48
  'style/linebreak-style': ['error', 'unix'],
46
49
  'style/max-len': [
47
50
  'error',
48
- 100,
51
+ 70,
49
52
  2,
50
- { ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true },
53
+ {
54
+ ignoreComments: true,
55
+ ignoreStrings: true,
56
+ ignoreTemplateLiterals: true,
57
+ },
51
58
  ],
52
59
  'style/member-delimiter-style': 'off',
53
60
  'style/multiline-ternary': 'off',
54
61
  'style/no-tabs': 'error',
55
62
  'style/operator-linebreak': 'off',
56
63
  'style/quote-props': 'off',
57
- 'style/quotes': ['error', 'single', { allowTemplateLiterals: true }],
64
+ 'style/quotes': [
65
+ 'error',
66
+ 'single',
67
+ { allowTemplateLiterals: true },
68
+ ],
58
69
  },
59
70
  })
60
71
  }
@@ -62,12 +73,19 @@ export function eslint({
62
73
  configs.push({
63
74
  name: 'notcodev/unicorn/rules',
64
75
  rules: {
65
- 'unicorn/filename-case': ['error', { case: 'kebabCase', ignore: ['^.*\.(vue|md)$'] }],
76
+ 'unicorn/filename-case': [
77
+ 'error',
78
+ { case: 'kebabCase', ignore: ['^.*\.(vue|md)$'] },
79
+ ],
66
80
  },
67
81
  })
68
82
 
69
83
  configs.push({
70
84
  name: 'notcodev/imports/rules',
85
+ ignores: [
86
+ // Ignore config files because usually config files has default export
87
+ '**/@(*.config.{ts,cts,mts,js,cjs,mjs}|.prettierrc.{js,cjs,mjs})',
88
+ ],
71
89
  rules: {
72
90
  'import/no-default-export': next ? 'off' : 'warn',
73
91
  },
@@ -76,7 +94,10 @@ export function eslint({
76
94
  configs.push({
77
95
  name: 'notcodev/perfectionist/rules',
78
96
  rules: {
79
- 'perfectionist/sort-array-includes': ['error', { order: 'asc', type: 'alphabetical' }],
97
+ 'perfectionist/sort-array-includes': [
98
+ 'error',
99
+ { order: 'asc', type: 'alphabetical' },
100
+ ],
80
101
  'perfectionist/sort-imports': [
81
102
  'error',
82
103
  {
@@ -100,13 +121,23 @@ export function eslint({
100
121
  ],
101
122
  'perfectionist/sort-interfaces': [
102
123
  'error',
103
- { groups: ['unknown', 'method', 'multiline'], order: 'asc', type: 'alphabetical' },
124
+ {
125
+ groups: ['unknown', 'method', 'multiline'],
126
+ order: 'asc',
127
+ type: 'alphabetical',
128
+ },
104
129
  ],
105
130
  'perfectionist/sort-jsx-props': [
106
131
  'error',
107
132
  {
108
133
  customGroups: { callback: 'on*', reserved: ['key', 'ref'] },
109
- groups: ['reserved', 'multiline', 'unknown', 'callback', 'shorthand'],
134
+ groups: [
135
+ 'reserved',
136
+ 'multiline',
137
+ 'unknown',
138
+ 'callback',
139
+ 'shorthand',
140
+ ],
110
141
  order: 'asc',
111
142
  type: 'alphabetical',
112
143
  },
@@ -144,6 +175,9 @@ export function eslint({
144
175
  'react/prefer-destructuring-assignment': 'warn',
145
176
  'react/no-useless-fragment': 'warn',
146
177
  'react/prefer-shorthand-boolean': 'warn',
178
+ 'react-hooks/no-direct-set-state-in-use-effect': next
179
+ ? 'off'
180
+ : 'warn',
147
181
  },
148
182
  })
149
183
  }
@@ -196,5 +230,8 @@ export function eslint({
196
230
  })
197
231
  }
198
232
 
199
- return antfu({ ...options, stylistic, lessOpinionated: true }, configs)
233
+ return antfu(
234
+ { ...options, stylistic, lessOpinionated: true },
235
+ configs,
236
+ )
200
237
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@notcodev/eslint",
3
3
  "type": "module",
4
- "version": "1.3.0",
4
+ "version": "1.4.1",
5
5
  "private": false,
6
6
  "description": "ESLint Configs",
7
7
  "author": {
@@ -54,7 +54,7 @@
54
54
  "devDependencies": {
55
55
  "@types/eslint-plugin-jsx-a11y": "^6.10.0",
56
56
  "prettier": "^3.5.3",
57
- "@notcodev/prettier": "1.1.0"
57
+ "@notcodev/prettier": "1.2.0"
58
58
  },
59
59
  "lint-staged": {
60
60
  "*.{js,ts,jsx,tsx,cjs,mjs,cts,mts}": [