@greenymcgee/next-eslint-config 0.1.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.
- package/README.md +35 -0
- package/index.mjs +68 -0
- package/package.json +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @greenymcgee/next-eslint-config
|
|
2
|
+
|
|
3
|
+
My ESLint config for Next.js projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# npm
|
|
9
|
+
npm install -D @greenymcgee/eslint-config
|
|
10
|
+
|
|
11
|
+
# pnpm
|
|
12
|
+
pnpm add -D @greenymcgee/eslint-config
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
import nextCoreWebVitals from 'eslint-config-next/core-web-vitals'
|
|
20
|
+
import nextTypescript from 'eslint-config-next/typescript'
|
|
21
|
+
import greenymcgeeConfig from '@greenymcgee/next-eslint-config'
|
|
22
|
+
|
|
23
|
+
export default [
|
|
24
|
+
...nextCoreWebVitals,
|
|
25
|
+
...nextTypescript,
|
|
26
|
+
...greenymcgeeConfig,
|
|
27
|
+
|
|
28
|
+
// Override or add rules as needed
|
|
29
|
+
{
|
|
30
|
+
rules: {
|
|
31
|
+
'no-console': 'warn',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
```
|
package/index.mjs
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import vitest from '@vitest/eslint-plugin';
|
|
2
|
+
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
3
|
+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
|
|
8
|
+
plugins: {
|
|
9
|
+
'@vitest': vitest,
|
|
10
|
+
'simple-import-sort': simpleImportSort,
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
// General rules
|
|
14
|
+
camelcase: 'error',
|
|
15
|
+
'require-await': 'error',
|
|
16
|
+
'no-console': 'error',
|
|
17
|
+
'object-shorthand': 'error',
|
|
18
|
+
|
|
19
|
+
// Vitest rules
|
|
20
|
+
'@vitest/max-expects': [
|
|
21
|
+
'error',
|
|
22
|
+
{
|
|
23
|
+
max: 2,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
// Import rules
|
|
28
|
+
'import/no-cycle': 'error',
|
|
29
|
+
'import/no-named-as-default': 0,
|
|
30
|
+
|
|
31
|
+
// Import sort rules
|
|
32
|
+
'simple-import-sort/exports': 'error',
|
|
33
|
+
'simple-import-sort/imports': [
|
|
34
|
+
'error',
|
|
35
|
+
{
|
|
36
|
+
groups: [['^react$', '^@?\\w'], ['^'], ['^\\.']],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
'sort-keys': 'error',
|
|
40
|
+
|
|
41
|
+
...jsxA11y.configs.recommended.rules,
|
|
42
|
+
'jsx-a11y/label-has-associated-control': [
|
|
43
|
+
'error',
|
|
44
|
+
{
|
|
45
|
+
labelComponents: ['Label'],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
|
|
49
|
+
// React rules
|
|
50
|
+
'react/button-has-type': 'error',
|
|
51
|
+
'react/jsx-boolean-value': 'error',
|
|
52
|
+
'react/jsx-no-leaked-render': 'error',
|
|
53
|
+
'react/jsx-sort-props': 'error',
|
|
54
|
+
'react/no-multi-comp': 'error',
|
|
55
|
+
'react/no-unused-prop-types': 2,
|
|
56
|
+
'react/self-closing-comp': 'error',
|
|
57
|
+
},
|
|
58
|
+
settings: {
|
|
59
|
+
'import/resolver': {
|
|
60
|
+
node: true,
|
|
61
|
+
typescript: true,
|
|
62
|
+
},
|
|
63
|
+
react: {
|
|
64
|
+
version: 'detect',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@greenymcgee/next-eslint-config",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./index.mjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.mjs"
|
|
8
|
+
},
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@vitest/eslint-plugin": "^1.0.0",
|
|
11
|
+
"eslint": "^9.0.0",
|
|
12
|
+
"eslint-config-next": "^16.0.0",
|
|
13
|
+
"eslint-plugin-simple-import-sort": "^12.0.0"
|
|
14
|
+
}
|
|
15
|
+
}
|