@vortiquo/eslint-config 1.0.3 → 1.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 +30 -8
- package/index.js +2 -0
- package/node-library-js.js +34 -0
- package/package.json +14 -8
- package/react-library-js.js +80 -0
package/README.md
CHANGED
|
@@ -27,14 +27,16 @@ yarn add -D @vortiquo/eslint-config eslint typescript
|
|
|
27
27
|
|
|
28
28
|
## Available Configs
|
|
29
29
|
|
|
30
|
-
| Config
|
|
31
|
-
|
|
|
32
|
-
| `nextjs`
|
|
33
|
-
| `server`
|
|
34
|
-
| `nestjs`
|
|
35
|
-
| `react`
|
|
36
|
-
| `react-library`
|
|
37
|
-
| `
|
|
30
|
+
| Config | Use Case |
|
|
31
|
+
| ------------------ | ----------------------------------------- |
|
|
32
|
+
| `nextjs` | Next.js applications |
|
|
33
|
+
| `server` | Backend APIs (Fastify, Express, Hono) |
|
|
34
|
+
| `nestjs` | NestJS applications |
|
|
35
|
+
| `react` | React applications |
|
|
36
|
+
| `react-library` | React/UI component libraries (TypeScript) |
|
|
37
|
+
| `react-library-js` | React/UI component libraries (JavaScript) |
|
|
38
|
+
| `node-library` | Shared Node.js packages (TypeScript) |
|
|
39
|
+
| `node-library-js` | Shared Node.js packages (JavaScript) |
|
|
38
40
|
|
|
39
41
|
## Usage
|
|
40
42
|
|
|
@@ -125,6 +127,24 @@ export default [
|
|
|
125
127
|
];
|
|
126
128
|
```
|
|
127
129
|
|
|
130
|
+
### JavaScript Projects (No TypeScript)
|
|
131
|
+
|
|
132
|
+
For projects without TypeScript, use the `-js` variants:
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
// Node.js library (JavaScript)
|
|
136
|
+
import { nodeLibraryJs } from '@vortiquo/eslint-config/node-library-js';
|
|
137
|
+
|
|
138
|
+
export default [...nodeLibraryJs];
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
// React library (JavaScript)
|
|
143
|
+
import { reactLibraryJs } from '@vortiquo/eslint-config/react-library-js';
|
|
144
|
+
|
|
145
|
+
export default [...reactLibraryJs];
|
|
146
|
+
```
|
|
147
|
+
|
|
128
148
|
## Extending Configs
|
|
129
149
|
|
|
130
150
|
All configs are arrays that can be spread and extended:
|
|
@@ -178,6 +198,8 @@ export default [
|
|
|
178
198
|
|
|
179
199
|
```
|
|
180
200
|
base (JS rules, Prettier, Turbo)
|
|
201
|
+
├── node-library-js (JS Node.js packages)
|
|
202
|
+
├── react-library-js (JS React libraries)
|
|
181
203
|
└── base-typescript (TS strict rules)
|
|
182
204
|
├── react (React + Hooks)
|
|
183
205
|
│ ├── react-library (stricter)
|
package/index.js
CHANGED
|
@@ -3,7 +3,9 @@ export { base } from './base.js';
|
|
|
3
3
|
export { baseTypescript } from './base-typescript.js';
|
|
4
4
|
export { react } from './react.js';
|
|
5
5
|
export { reactLibrary } from './react-library.js';
|
|
6
|
+
export { reactLibraryJs } from './react-library-js.js';
|
|
6
7
|
export { nextjs } from './nextjs.js';
|
|
7
8
|
export { server } from './server.js';
|
|
8
9
|
export { nestjs } from './nestjs.js';
|
|
9
10
|
export { nodeLibrary } from './node-library.js';
|
|
11
|
+
export { nodeLibraryJs } from './node-library-js.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import globals from 'globals';
|
|
2
|
+
import { base } from './base.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ESLint configuration for JavaScript Node.js libraries/packages.
|
|
6
|
+
* For projects without TypeScript - extends base config only.
|
|
7
|
+
*
|
|
8
|
+
* @type {import("eslint").Linter.Config[]}
|
|
9
|
+
*/
|
|
10
|
+
export const nodeLibraryJs = [
|
|
11
|
+
...base,
|
|
12
|
+
{
|
|
13
|
+
name: 'vortiquo/node-library-js',
|
|
14
|
+
languageOptions: {
|
|
15
|
+
globals: {
|
|
16
|
+
...globals.node,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
// No console in libraries (consumers should handle logging)
|
|
21
|
+
'no-console': 'error',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'vortiquo/node-library-js/config-files',
|
|
26
|
+
files: ['**/*.config.{js,mjs,cjs}', '**/.*rc.{js,mjs,cjs}'],
|
|
27
|
+
rules: {
|
|
28
|
+
'import/no-default-export': 'off',
|
|
29
|
+
'no-console': 'off',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export default nodeLibraryJs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vortiquo/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Modern ESLint v9 flat configurations with TypeScript, React, Next.js, and Node.js support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,10 +43,12 @@
|
|
|
43
43
|
"./base-typescript": "./base-typescript.js",
|
|
44
44
|
"./react": "./react.js",
|
|
45
45
|
"./react-library": "./react-library.js",
|
|
46
|
+
"./react-library-js": "./react-library-js.js",
|
|
46
47
|
"./nextjs": "./nextjs.js",
|
|
47
48
|
"./server": "./server.js",
|
|
48
49
|
"./nestjs": "./nestjs.js",
|
|
49
|
-
"./node-library": "./node-library.js"
|
|
50
|
+
"./node-library": "./node-library.js",
|
|
51
|
+
"./node-library-js": "./node-library-js.js"
|
|
50
52
|
},
|
|
51
53
|
"files": [
|
|
52
54
|
"index.js",
|
|
@@ -54,20 +56,18 @@
|
|
|
54
56
|
"base-typescript.js",
|
|
55
57
|
"react.js",
|
|
56
58
|
"react-library.js",
|
|
59
|
+
"react-library-js.js",
|
|
57
60
|
"nextjs.js",
|
|
58
61
|
"server.js",
|
|
59
62
|
"nestjs.js",
|
|
60
63
|
"node-library.js",
|
|
64
|
+
"node-library-js.js",
|
|
61
65
|
"README.md",
|
|
62
66
|
"LICENSE"
|
|
63
67
|
],
|
|
64
68
|
"dependencies": {
|
|
65
|
-
"@commitlint/cli": "^20.2.0",
|
|
66
|
-
"@commitlint/config-conventional": "^20.2.0",
|
|
67
69
|
"@eslint/js": "^9.17.0",
|
|
68
|
-
"@ls-lint/ls-lint": "^2.3.1",
|
|
69
70
|
"@next/eslint-plugin-next": "^16.1.0",
|
|
70
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
71
71
|
"eslint-config-prettier": "^10.0.1",
|
|
72
72
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
73
73
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -77,10 +77,16 @@
|
|
|
77
77
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
78
78
|
"eslint-plugin-turbo": "^2.3.3",
|
|
79
79
|
"globals": "^16.5.0",
|
|
80
|
+
"typescript-eslint": "^8.18.1"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@commitlint/cli": "^20.2.0",
|
|
84
|
+
"@commitlint/config-conventional": "^20.2.0",
|
|
85
|
+
"@ls-lint/ls-lint": "^2.3.1",
|
|
86
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
80
87
|
"husky": "^9.1.7",
|
|
81
88
|
"lint-staged": "^16.2.7",
|
|
82
|
-
"prettier": "^3.7.4"
|
|
83
|
-
"typescript-eslint": "^8.18.1"
|
|
89
|
+
"prettier": "^3.7.4"
|
|
84
90
|
},
|
|
85
91
|
"peerDependencies": {
|
|
86
92
|
"eslint": "^9.0.0",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import reactPlugin from 'eslint-plugin-react';
|
|
2
|
+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
3
|
+
import globals from 'globals';
|
|
4
|
+
import { base } from './base.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ESLint configuration for JavaScript React libraries/components.
|
|
8
|
+
* For projects without TypeScript - extends base config only.
|
|
9
|
+
*
|
|
10
|
+
* @type {import("eslint").Linter.Config[]}
|
|
11
|
+
*/
|
|
12
|
+
export const reactLibraryJs = [
|
|
13
|
+
...base,
|
|
14
|
+
{
|
|
15
|
+
name: 'vortiquo/react-library-js',
|
|
16
|
+
files: ['**/*.{js,jsx,mjs,cjs}'],
|
|
17
|
+
plugins: {
|
|
18
|
+
react: reactPlugin,
|
|
19
|
+
'react-hooks': reactHooksPlugin,
|
|
20
|
+
},
|
|
21
|
+
languageOptions: {
|
|
22
|
+
globals: {
|
|
23
|
+
...globals.browser,
|
|
24
|
+
},
|
|
25
|
+
parserOptions: {
|
|
26
|
+
ecmaFeatures: {
|
|
27
|
+
jsx: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
settings: {
|
|
32
|
+
react: {
|
|
33
|
+
version: 'detect',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
rules: {
|
|
37
|
+
// React recommended
|
|
38
|
+
...reactPlugin.configs.recommended.rules,
|
|
39
|
+
...reactPlugin.configs['jsx-runtime'].rules,
|
|
40
|
+
|
|
41
|
+
// React Hooks
|
|
42
|
+
...reactHooksPlugin.configs.recommended.rules,
|
|
43
|
+
|
|
44
|
+
// React preferences
|
|
45
|
+
'react/prop-types': 'off',
|
|
46
|
+
'react/jsx-no-target-blank': 'error',
|
|
47
|
+
'react/jsx-curly-brace-presence': [
|
|
48
|
+
'error',
|
|
49
|
+
{ props: 'never', children: 'never' },
|
|
50
|
+
],
|
|
51
|
+
'react/self-closing-comp': 'error',
|
|
52
|
+
'react/jsx-sort-props': [
|
|
53
|
+
'warn',
|
|
54
|
+
{
|
|
55
|
+
callbacksLast: true,
|
|
56
|
+
shorthandFirst: true,
|
|
57
|
+
reservedFirst: true,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
// Hooks
|
|
62
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
63
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
64
|
+
|
|
65
|
+
// Not needed without TypeScript
|
|
66
|
+
'react/require-default-props': 'off',
|
|
67
|
+
'react/jsx-props-no-spreading': 'off',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'vortiquo/react-library-js/config-files',
|
|
72
|
+
files: ['**/*.config.{js,mjs,cjs}', '**/.*rc.{js,mjs,cjs}'],
|
|
73
|
+
rules: {
|
|
74
|
+
'import/no-default-export': 'off',
|
|
75
|
+
'no-console': 'off',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
export default reactLibraryJs;
|