@kiid_brian/eslint-config 0.2.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 +225 -0
- package/configs/base.js +171 -0
- package/configs/node.js +22 -0
- package/configs/react.js +37 -0
- package/configs/strict.js +29 -0
- package/index.js +82 -0
- package/package.json +289 -0
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# ESLint Config Kiidbrian
|
|
2
|
+
|
|
3
|
+
A comprehensive, flexible ESLint configuration package for TypeScript and JavaScript projects.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✅ **Multiple Presets**: Choose from base, React, Node.js, or strict configurations
|
|
8
|
+
- ✅ **TypeScript Support**: Full type-aware linting
|
|
9
|
+
- ✅ **React Support**: JSX, accessibility, and React-specific rules
|
|
10
|
+
- ✅ **Import Organization**: Automatic import sorting and validation
|
|
11
|
+
- ✅ **Security Rules**: Built-in security best practices
|
|
12
|
+
- ✅ **Documentation**: JSDoc requirements for better code documentation
|
|
13
|
+
- ✅ **Prettier Integration**: Seamless integration with Prettier
|
|
14
|
+
- ✅ **Customizable**: Easy configuration overrides and custom rules
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install --save-dev eslint-config-kiidbrian
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Peer Dependencies
|
|
23
|
+
|
|
24
|
+
Install the required peer dependencies:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install --save-dev \
|
|
28
|
+
@eslint/js \
|
|
29
|
+
eslint \
|
|
30
|
+
eslint-config-prettier \
|
|
31
|
+
eslint-plugin-import \
|
|
32
|
+
eslint-plugin-jsx-a11y \
|
|
33
|
+
eslint-plugin-jsdoc \
|
|
34
|
+
eslint-plugin-prettier \
|
|
35
|
+
eslint-plugin-react \
|
|
36
|
+
eslint-plugin-security \
|
|
37
|
+
globals \
|
|
38
|
+
prettier \
|
|
39
|
+
typescript-eslint
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### Basic Usage (Default React Configuration)
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
// eslint.config.js
|
|
48
|
+
import config from "eslint-config-kiidbrian";
|
|
49
|
+
|
|
50
|
+
export default config;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Using Specific Presets
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
// eslint.config.js
|
|
57
|
+
import {react} from "eslint-config-kiidbrian";
|
|
58
|
+
|
|
59
|
+
export default react;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Available presets:
|
|
63
|
+
|
|
64
|
+
- `react` (default) - Full React + TypeScript configuration
|
|
65
|
+
- `base` - Core TypeScript/JavaScript without React
|
|
66
|
+
- `node` - Optimized for Node.js applications
|
|
67
|
+
- `strict` - Maximum code quality with stricter rules
|
|
68
|
+
|
|
69
|
+
### Direct Import from Configs
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
// eslint.config.js
|
|
73
|
+
import reactConfig from "eslint-config-kiidbrian/configs/react.js";
|
|
74
|
+
|
|
75
|
+
export default reactConfig;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Custom Configuration
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
// eslint.config.js
|
|
82
|
+
import {createConfig} from "eslint-config-kiidbrian";
|
|
83
|
+
|
|
84
|
+
export default createConfig({
|
|
85
|
+
preset: "base",
|
|
86
|
+
environments: ["jest"],
|
|
87
|
+
overrides: [
|
|
88
|
+
{
|
|
89
|
+
rules: {
|
|
90
|
+
"no-console": "off",
|
|
91
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Configuration Options
|
|
99
|
+
|
|
100
|
+
### `createConfig(options)`
|
|
101
|
+
|
|
102
|
+
#### `preset`
|
|
103
|
+
|
|
104
|
+
- Type: `string`
|
|
105
|
+
- Default: `"react"`
|
|
106
|
+
- Options: `"base" | "react" | "node" | "strict"`
|
|
107
|
+
|
|
108
|
+
Choose the base configuration preset.
|
|
109
|
+
|
|
110
|
+
#### `environments`
|
|
111
|
+
|
|
112
|
+
- Type: `string[]`
|
|
113
|
+
- Default: `[]`
|
|
114
|
+
- Options: `"jest" | "vitest"`
|
|
115
|
+
|
|
116
|
+
Add environment-specific globals and rules.
|
|
117
|
+
|
|
118
|
+
#### `overrides`
|
|
119
|
+
|
|
120
|
+
- Type: `Array<ESLintConfig>`
|
|
121
|
+
- Default: `[]`
|
|
122
|
+
|
|
123
|
+
Custom ESLint configuration objects to merge with the preset.
|
|
124
|
+
|
|
125
|
+
## Examples
|
|
126
|
+
|
|
127
|
+
### React Project
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
// eslint.config.js
|
|
131
|
+
import config from "eslint-config-kiidbrian";
|
|
132
|
+
|
|
133
|
+
export default config;
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Node.js API
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
// eslint.config.js
|
|
140
|
+
import {node} from "eslint-config-kiidbrian";
|
|
141
|
+
|
|
142
|
+
export default node;
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Strict Library Code
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
// eslint.config.js
|
|
149
|
+
import {strict} from "eslint-config-kiidbrian";
|
|
150
|
+
|
|
151
|
+
export default strict;
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Testing Environment
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
// eslint.config.js
|
|
158
|
+
import {createConfig} from "eslint-config-kiidbrian";
|
|
159
|
+
|
|
160
|
+
export default createConfig({
|
|
161
|
+
preset: "react",
|
|
162
|
+
environments: ["jest"],
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Custom Overrides
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
// eslint.config.js
|
|
170
|
+
import {createConfig} from "eslint-config-kiidbrian";
|
|
171
|
+
|
|
172
|
+
export default createConfig({
|
|
173
|
+
preset: "base",
|
|
174
|
+
overrides: [
|
|
175
|
+
{
|
|
176
|
+
rules: {
|
|
177
|
+
"no-console": "off",
|
|
178
|
+
"@typescript-eslint/explicit-function-return-type": "warn",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Included Rules
|
|
186
|
+
|
|
187
|
+
### TypeScript
|
|
188
|
+
|
|
189
|
+
- Type-aware linting
|
|
190
|
+
- Strict type checking
|
|
191
|
+
- Unused variable detection
|
|
192
|
+
- Import/export validation
|
|
193
|
+
|
|
194
|
+
### React
|
|
195
|
+
|
|
196
|
+
- JSX best practices
|
|
197
|
+
- Accessibility (a11y) rules
|
|
198
|
+
- Component patterns
|
|
199
|
+
- Hook rules
|
|
200
|
+
|
|
201
|
+
### Code Quality
|
|
202
|
+
|
|
203
|
+
- Import organization
|
|
204
|
+
- Security vulnerabilities
|
|
205
|
+
- JSDoc documentation
|
|
206
|
+
- General best practices
|
|
207
|
+
|
|
208
|
+
### Environments
|
|
209
|
+
|
|
210
|
+
- Browser globals
|
|
211
|
+
- Node.js globals
|
|
212
|
+
- Jest/Vitest testing globals
|
|
213
|
+
- Config file allowances
|
|
214
|
+
|
|
215
|
+
## Contributing
|
|
216
|
+
|
|
217
|
+
1. Fork the repository
|
|
218
|
+
2. Create your feature branch
|
|
219
|
+
3. Make your changes
|
|
220
|
+
4. Run tests and linting
|
|
221
|
+
5. Submit a pull request
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT © Brian Paintsil
|
package/configs/base.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import ts from "typescript-eslint";
|
|
3
|
+
import globals from "globals";
|
|
4
|
+
import prettierRecommended from "eslint-plugin-prettier/recommended";
|
|
5
|
+
import importPlugin from "eslint-plugin-import";
|
|
6
|
+
import jsdoc from "eslint-plugin-jsdoc";
|
|
7
|
+
import security from "eslint-plugin-security";
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
// Base ESLint recommended rules
|
|
11
|
+
js.configs.recommended,
|
|
12
|
+
|
|
13
|
+
// TypeScript recommended rules
|
|
14
|
+
...ts.configs.recommended,
|
|
15
|
+
...ts.configs.recommendedTypeChecked,
|
|
16
|
+
|
|
17
|
+
// Import rules
|
|
18
|
+
importPlugin.flatConfigs.recommended,
|
|
19
|
+
importPlugin.flatConfigs.typescript,
|
|
20
|
+
|
|
21
|
+
// Security rules
|
|
22
|
+
security.configs.recommended,
|
|
23
|
+
|
|
24
|
+
// JSDoc rules
|
|
25
|
+
jsdoc.configs["flat/recommended"],
|
|
26
|
+
|
|
27
|
+
// Custom configuration
|
|
28
|
+
{
|
|
29
|
+
languageOptions: {
|
|
30
|
+
globals: {
|
|
31
|
+
...globals.node,
|
|
32
|
+
...globals.browser,
|
|
33
|
+
...globals.es2021,
|
|
34
|
+
},
|
|
35
|
+
parser: ts.parser,
|
|
36
|
+
parserOptions: {
|
|
37
|
+
ecmaVersion: "latest",
|
|
38
|
+
sourceType: "module",
|
|
39
|
+
project: true, // Enable type-aware rules
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
plugins: {
|
|
43
|
+
import: importPlugin,
|
|
44
|
+
jsdoc,
|
|
45
|
+
security,
|
|
46
|
+
},
|
|
47
|
+
rules: {
|
|
48
|
+
// Console and debugging
|
|
49
|
+
"no-console": "warn",
|
|
50
|
+
"no-debugger": "error",
|
|
51
|
+
|
|
52
|
+
// TypeScript specific rules
|
|
53
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
54
|
+
"@typescript-eslint/no-unused-vars": [
|
|
55
|
+
"error",
|
|
56
|
+
{
|
|
57
|
+
argsIgnorePattern: "^_",
|
|
58
|
+
varsIgnorePattern: "^_",
|
|
59
|
+
caughtErrorsIgnorePattern: "^_",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
63
|
+
"@typescript-eslint/prefer-const": "error",
|
|
64
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
65
|
+
|
|
66
|
+
// Import rules
|
|
67
|
+
"import/no-unresolved": "error",
|
|
68
|
+
"import/named": "error",
|
|
69
|
+
"import/default": "error",
|
|
70
|
+
"import/namespace": "error",
|
|
71
|
+
"import/no-absolute-path": "error",
|
|
72
|
+
"import/no-dynamic-require": "warn",
|
|
73
|
+
"import/no-webpack-loader-syntax": "error",
|
|
74
|
+
"import/order": [
|
|
75
|
+
"error",
|
|
76
|
+
{
|
|
77
|
+
groups: [
|
|
78
|
+
"builtin",
|
|
79
|
+
"external",
|
|
80
|
+
"internal",
|
|
81
|
+
"parent",
|
|
82
|
+
"sibling",
|
|
83
|
+
"index",
|
|
84
|
+
],
|
|
85
|
+
"newlines-between": "always",
|
|
86
|
+
alphabetize: {order: "asc", caseInsensitive: true},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
|
|
90
|
+
// Security rules
|
|
91
|
+
"security/detect-object-injection": "warn",
|
|
92
|
+
"security/detect-non-literal-regexp": "warn",
|
|
93
|
+
"security/detect-unsafe-regex": "error",
|
|
94
|
+
|
|
95
|
+
// JSDoc rules
|
|
96
|
+
"jsdoc/require-description": "warn",
|
|
97
|
+
"jsdoc/check-values": "warn",
|
|
98
|
+
"jsdoc/check-param-names": "error",
|
|
99
|
+
"jsdoc/check-tag-names": "error",
|
|
100
|
+
"jsdoc/require-param": "warn",
|
|
101
|
+
"jsdoc/require-returns": "warn",
|
|
102
|
+
|
|
103
|
+
// General code quality
|
|
104
|
+
"no-unused-vars": "off", // Use @typescript-eslint/no-unused-vars instead
|
|
105
|
+
"prefer-const": "error",
|
|
106
|
+
"no-var": "error",
|
|
107
|
+
"object-shorthand": "error",
|
|
108
|
+
"prefer-arrow-callback": "error",
|
|
109
|
+
"prefer-template": "error",
|
|
110
|
+
eqeqeq: ["error", "always"],
|
|
111
|
+
curly: ["error", "all"],
|
|
112
|
+
"no-duplicate-imports": "error",
|
|
113
|
+
},
|
|
114
|
+
settings: {
|
|
115
|
+
"import/resolver": {
|
|
116
|
+
typescript: true,
|
|
117
|
+
node: true,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
// Environment-specific configurations
|
|
123
|
+
{
|
|
124
|
+
files: ["**/*.test.{ts,tsx,js,jsx}", "**/*.spec.{ts,tsx,js,jsx}"],
|
|
125
|
+
languageOptions: {
|
|
126
|
+
globals: {
|
|
127
|
+
...globals.jest,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
rules: {
|
|
131
|
+
"@typescript-eslint/no-explicit-any": "off", // Allow any in tests
|
|
132
|
+
"jsdoc/require-description": "off", // Less strict JSDoc in tests
|
|
133
|
+
"jsdoc/require-param": "off",
|
|
134
|
+
"jsdoc/require-returns": "off",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
{
|
|
139
|
+
files: [
|
|
140
|
+
"**/*.config.{ts,js}",
|
|
141
|
+
"**/vite.config.{ts,js}",
|
|
142
|
+
"**/vitest.config.{ts,js}",
|
|
143
|
+
],
|
|
144
|
+
rules: {
|
|
145
|
+
"no-console": "off", // Allow console in config files
|
|
146
|
+
"@typescript-eslint/no-var-requires": "off", // Allow require in configs
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
// Ignore patterns
|
|
151
|
+
{
|
|
152
|
+
ignores: [
|
|
153
|
+
"dist/**",
|
|
154
|
+
"build/**",
|
|
155
|
+
"node_modules/**",
|
|
156
|
+
"*.min.js",
|
|
157
|
+
"*.bundle.js",
|
|
158
|
+
"coverage/**",
|
|
159
|
+
".next/**",
|
|
160
|
+
".nuxt/**",
|
|
161
|
+
".output/**",
|
|
162
|
+
".vercel/**",
|
|
163
|
+
".netlify/**",
|
|
164
|
+
"public/**",
|
|
165
|
+
"**/*.d.ts",
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
// Prettier must be last to override conflicting rules
|
|
170
|
+
prettierRecommended,
|
|
171
|
+
];
|
package/configs/node.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import baseConfig from "./base.js";
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
...baseConfig,
|
|
6
|
+
|
|
7
|
+
// Node.js-specific configuration
|
|
8
|
+
{
|
|
9
|
+
languageOptions: {
|
|
10
|
+
globals: {
|
|
11
|
+
...globals.node,
|
|
12
|
+
...globals.es2021,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
"no-console": "off",
|
|
17
|
+
|
|
18
|
+
// Node.js specific rules can be added here
|
|
19
|
+
// For example, you might want to enforce certain patterns
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
package/configs/react.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
2
|
+
import react from "eslint-plugin-react";
|
|
3
|
+
import baseConfig from "./base.js";
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
...baseConfig,
|
|
7
|
+
|
|
8
|
+
// React recommended rules
|
|
9
|
+
react.configs.flat.recommended,
|
|
10
|
+
react.configs.flat["jsx-runtime"],
|
|
11
|
+
|
|
12
|
+
// Accessibility rules
|
|
13
|
+
jsxA11y.flatConfigs.recommended,
|
|
14
|
+
|
|
15
|
+
// React-specific configuration
|
|
16
|
+
{
|
|
17
|
+
plugins: {
|
|
18
|
+
"jsx-a11y": jsxA11y,
|
|
19
|
+
react,
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
// React specific rules
|
|
23
|
+
"react/prop-types": "off", // TypeScript handles prop validation
|
|
24
|
+
"react/react-in-jsx-scope": "off", // Not needed in React 17+
|
|
25
|
+
"react/jsx-uses-react": "off", // Not needed in React 17+
|
|
26
|
+
"react/jsx-uses-vars": "error",
|
|
27
|
+
"react/jsx-key": ["error", {checkFragmentShorthand: true}],
|
|
28
|
+
"react/jsx-no-useless-fragment": "error",
|
|
29
|
+
"react/self-closing-comp": "error",
|
|
30
|
+
},
|
|
31
|
+
settings: {
|
|
32
|
+
react: {
|
|
33
|
+
version: "detect",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import baseConfig from "./base.js";
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...baseConfig,
|
|
5
|
+
|
|
6
|
+
// Strict configuration overrides
|
|
7
|
+
{
|
|
8
|
+
rules: {
|
|
9
|
+
// Stricter TypeScript rules
|
|
10
|
+
"@typescript-eslint/no-explicit-any": "error", // Upgrade to error
|
|
11
|
+
"@typescript-eslint/explicit-function-return-type": "warn", // Enable return type requirements
|
|
12
|
+
|
|
13
|
+
// Stricter JSDoc requirements
|
|
14
|
+
"jsdoc/require-description": "error", // Upgrade to error
|
|
15
|
+
"jsdoc/require-param": "error", // Upgrade to error
|
|
16
|
+
"jsdoc/require-returns": "error", // Upgrade to error
|
|
17
|
+
|
|
18
|
+
// Stricter general rules
|
|
19
|
+
"no-console": "error", // Upgrade to error
|
|
20
|
+
"security/detect-object-injection": "error", // Upgrade to error
|
|
21
|
+
|
|
22
|
+
// Additional strict rules
|
|
23
|
+
complexity: ["error", 10], // Limit cyclomatic complexity
|
|
24
|
+
"max-depth": ["error", 4], // Limit nesting depth
|
|
25
|
+
"max-lines-per-function": ["error", 50], // Limit function length
|
|
26
|
+
"max-params": ["error", 4], // Limit parameter count
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
package/index.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import baseConfig from "./configs/base.js";
|
|
2
|
+
import reactConfig from "./configs/react.js";
|
|
3
|
+
import nodeConfig from "./configs/node.js";
|
|
4
|
+
import strictConfig from "./configs/strict.js";
|
|
5
|
+
|
|
6
|
+
// Default export (backwards compatibility with original eslint.config.js)
|
|
7
|
+
export default reactConfig;
|
|
8
|
+
|
|
9
|
+
// Named exports for different presets
|
|
10
|
+
export const base = baseConfig;
|
|
11
|
+
export const react = reactConfig;
|
|
12
|
+
export const node = nodeConfig;
|
|
13
|
+
export const strict = strictConfig;
|
|
14
|
+
|
|
15
|
+
// Function to create custom config with overrides
|
|
16
|
+
export function createConfig(options = {}) {
|
|
17
|
+
const {
|
|
18
|
+
preset = "react", // default preset
|
|
19
|
+
overrides = [],
|
|
20
|
+
environments = [],
|
|
21
|
+
typescript = true,
|
|
22
|
+
react: enableReact = true,
|
|
23
|
+
accessibility = true,
|
|
24
|
+
security = true,
|
|
25
|
+
jsdoc = true,
|
|
26
|
+
prettier = true,
|
|
27
|
+
} = options;
|
|
28
|
+
|
|
29
|
+
// Start with the chosen preset
|
|
30
|
+
let config;
|
|
31
|
+
switch (preset) {
|
|
32
|
+
case "base":
|
|
33
|
+
config = [...baseConfig];
|
|
34
|
+
break;
|
|
35
|
+
case "react":
|
|
36
|
+
config = [...reactConfig];
|
|
37
|
+
break;
|
|
38
|
+
case "node":
|
|
39
|
+
config = [...nodeConfig];
|
|
40
|
+
break;
|
|
41
|
+
case "strict":
|
|
42
|
+
config = [...strictConfig];
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
throw new Error(
|
|
46
|
+
`Unknown preset: ${preset}. Available presets: base, react, node, strict`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Add environment-specific configurations
|
|
51
|
+
if (environments.includes("jest")) {
|
|
52
|
+
config.push({
|
|
53
|
+
files: ["**/*.test.{ts,tsx,js,jsx}", "**/*.spec.{ts,tsx,js,jsx}"],
|
|
54
|
+
languageOptions: {
|
|
55
|
+
globals: {
|
|
56
|
+
...require("globals").jest,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (environments.includes("vitest")) {
|
|
63
|
+
config.push({
|
|
64
|
+
files: ["**/*.test.{ts,tsx,js,jsx}", "**/*.spec.{ts,tsx,js,jsx}"],
|
|
65
|
+
languageOptions: {
|
|
66
|
+
globals: {
|
|
67
|
+
...require("globals").vitest,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Apply custom overrides
|
|
74
|
+
if (overrides.length > 0) {
|
|
75
|
+
config.push(...overrides);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Re-export individual configs for advanced usage
|
|
82
|
+
export {baseConfig, reactConfig, nodeConfig, strictConfig};
|
package/package.json
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kiid_brian/eslint-config",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "ESLint config for @kiid_brian",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"eslint-config"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/kiidbrian/eslint-config-kiidbrian#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/kiidbrian/eslint-config-kiidbrian/issues"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/kiidbrian/eslint-config-kiidbrian.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Brian Paintsil",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./index.js",
|
|
22
|
+
"./base": "./configs/base.js",
|
|
23
|
+
"./react": "./configs/react.js",
|
|
24
|
+
"./node": "./configs/node.js",
|
|
25
|
+
"./strict": "./configs/strict.js"
|
|
26
|
+
},
|
|
27
|
+
"main": "index.js",
|
|
28
|
+
"files": [
|
|
29
|
+
"index.js",
|
|
30
|
+
"configs/"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"lint": "eslint . --ext .js,.ts",
|
|
34
|
+
"lint:fix": "eslint . --ext .js,.ts --fix",
|
|
35
|
+
"test": "node -e \"const fs = require('fs'); const path = require('path'); ['index.js', 'configs/base.js', 'configs/react.js', 'configs/node.js', 'configs/strict.js'].forEach(f => { if (fs.existsSync(f)) console.log('✅', f); else console.log('❌ Missing:', f); });\""
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"acorn": "^8.15.0",
|
|
39
|
+
"acorn-jsx": "^5.3.2",
|
|
40
|
+
"ajv": "^6.12.6",
|
|
41
|
+
"ansi-styles": "^4.3.0",
|
|
42
|
+
"are-docs-informative": "^0.0.2",
|
|
43
|
+
"argparse": "^2.0.1",
|
|
44
|
+
"aria-query": "^5.3.2",
|
|
45
|
+
"array-buffer-byte-length": "^1.0.2",
|
|
46
|
+
"array-includes": "^3.1.9",
|
|
47
|
+
"array.prototype.findlast": "^1.2.5",
|
|
48
|
+
"array.prototype.findlastindex": "^1.2.6",
|
|
49
|
+
"array.prototype.flat": "^1.3.3",
|
|
50
|
+
"array.prototype.flatmap": "^1.3.3",
|
|
51
|
+
"array.prototype.tosorted": "^1.1.4",
|
|
52
|
+
"arraybuffer.prototype.slice": "^1.0.4",
|
|
53
|
+
"ast-types-flow": "^0.0.8",
|
|
54
|
+
"async-function": "^1.0.0",
|
|
55
|
+
"available-typed-arrays": "^1.0.7",
|
|
56
|
+
"axe-core": "^4.11.0",
|
|
57
|
+
"axobject-query": "^4.1.0",
|
|
58
|
+
"balanced-match": "^1.0.2",
|
|
59
|
+
"brace-expansion": "^1.1.12",
|
|
60
|
+
"call-bind": "^1.0.8",
|
|
61
|
+
"call-bind-apply-helpers": "^1.0.2",
|
|
62
|
+
"call-bound": "^1.0.4",
|
|
63
|
+
"callsites": "^3.1.0",
|
|
64
|
+
"chalk": "^4.1.2",
|
|
65
|
+
"color-convert": "^2.0.1",
|
|
66
|
+
"color-name": "^1.1.4",
|
|
67
|
+
"comment-parser": "^1.4.1",
|
|
68
|
+
"concat-map": "^0.0.1",
|
|
69
|
+
"cross-spawn": "^7.0.6",
|
|
70
|
+
"damerau-levenshtein": "^1.0.8",
|
|
71
|
+
"data-view-buffer": "^1.0.2",
|
|
72
|
+
"data-view-byte-length": "^1.0.2",
|
|
73
|
+
"data-view-byte-offset": "^1.0.1",
|
|
74
|
+
"debug": "^4.4.3",
|
|
75
|
+
"deep-is": "^0.1.4",
|
|
76
|
+
"define-data-property": "^1.1.4",
|
|
77
|
+
"define-properties": "^1.2.1",
|
|
78
|
+
"doctrine": "^2.1.0",
|
|
79
|
+
"dunder-proto": "^1.0.1",
|
|
80
|
+
"emoji-regex": "^9.2.2",
|
|
81
|
+
"es-abstract": "^1.24.1",
|
|
82
|
+
"es-define-property": "^1.0.1",
|
|
83
|
+
"es-errors": "^1.3.0",
|
|
84
|
+
"es-iterator-helpers": "^1.2.2",
|
|
85
|
+
"es-object-atoms": "^1.1.1",
|
|
86
|
+
"es-set-tostringtag": "^2.1.0",
|
|
87
|
+
"es-shim-unscopables": "^1.1.0",
|
|
88
|
+
"es-to-primitive": "^1.3.0",
|
|
89
|
+
"escape-string-regexp": "^4.0.0",
|
|
90
|
+
"eslint-import-resolver-node": "^0.3.9",
|
|
91
|
+
"eslint-module-utils": "^2.12.1",
|
|
92
|
+
"eslint-scope": "^8.4.0",
|
|
93
|
+
"eslint-visitor-keys": "^4.2.1",
|
|
94
|
+
"espree": "^10.4.0",
|
|
95
|
+
"esquery": "^1.7.0",
|
|
96
|
+
"esrecurse": "^4.3.0",
|
|
97
|
+
"estraverse": "^5.3.0",
|
|
98
|
+
"esutils": "^2.0.3",
|
|
99
|
+
"fast-deep-equal": "^3.1.3",
|
|
100
|
+
"fast-diff": "^1.3.0",
|
|
101
|
+
"fast-json-stable-stringify": "^2.1.0",
|
|
102
|
+
"fast-levenshtein": "^2.0.6",
|
|
103
|
+
"fdir": "^6.5.0",
|
|
104
|
+
"file-entry-cache": "^8.0.0",
|
|
105
|
+
"find-up": "^5.0.0",
|
|
106
|
+
"flat-cache": "^4.0.1",
|
|
107
|
+
"flatted": "^3.3.3",
|
|
108
|
+
"for-each": "^0.3.5",
|
|
109
|
+
"function-bind": "^1.1.2",
|
|
110
|
+
"function.prototype.name": "^1.1.8",
|
|
111
|
+
"functions-have-names": "^1.2.3",
|
|
112
|
+
"generator-function": "^2.0.1",
|
|
113
|
+
"get-intrinsic": "^1.3.0",
|
|
114
|
+
"get-proto": "^1.0.1",
|
|
115
|
+
"get-symbol-description": "^1.1.0",
|
|
116
|
+
"glob-parent": "^6.0.2",
|
|
117
|
+
"globalthis": "^1.0.4",
|
|
118
|
+
"gopd": "^1.2.0",
|
|
119
|
+
"has-bigints": "^1.1.0",
|
|
120
|
+
"has-flag": "^4.0.0",
|
|
121
|
+
"has-property-descriptors": "^1.0.2",
|
|
122
|
+
"has-proto": "^1.2.0",
|
|
123
|
+
"has-symbols": "^1.1.0",
|
|
124
|
+
"has-tostringtag": "^1.0.2",
|
|
125
|
+
"hasown": "^2.0.2",
|
|
126
|
+
"ignore": "^5.3.2",
|
|
127
|
+
"import-fresh": "^3.3.1",
|
|
128
|
+
"imurmurhash": "^0.1.4",
|
|
129
|
+
"internal-slot": "^1.1.0",
|
|
130
|
+
"is-array-buffer": "^3.0.5",
|
|
131
|
+
"is-async-function": "^2.1.1",
|
|
132
|
+
"is-bigint": "^1.1.0",
|
|
133
|
+
"is-boolean-object": "^1.2.2",
|
|
134
|
+
"is-callable": "^1.2.7",
|
|
135
|
+
"is-core-module": "^2.16.1",
|
|
136
|
+
"is-data-view": "^1.0.2",
|
|
137
|
+
"is-date-object": "^1.1.0",
|
|
138
|
+
"is-extglob": "^2.1.1",
|
|
139
|
+
"is-finalizationregistry": "^1.1.1",
|
|
140
|
+
"is-generator-function": "^1.1.2",
|
|
141
|
+
"is-glob": "^4.0.3",
|
|
142
|
+
"is-map": "^2.0.3",
|
|
143
|
+
"is-negative-zero": "^2.0.3",
|
|
144
|
+
"is-number-object": "^1.1.1",
|
|
145
|
+
"is-regex": "^1.2.1",
|
|
146
|
+
"is-set": "^2.0.3",
|
|
147
|
+
"is-shared-array-buffer": "^1.0.4",
|
|
148
|
+
"is-string": "^1.1.1",
|
|
149
|
+
"is-symbol": "^1.1.1",
|
|
150
|
+
"is-typed-array": "^1.1.15",
|
|
151
|
+
"is-weakmap": "^2.0.2",
|
|
152
|
+
"is-weakref": "^1.1.1",
|
|
153
|
+
"is-weakset": "^2.0.4",
|
|
154
|
+
"isarray": "^2.0.5",
|
|
155
|
+
"isexe": "^2.0.0",
|
|
156
|
+
"iterator.prototype": "^1.1.5",
|
|
157
|
+
"js-tokens": "^4.0.0",
|
|
158
|
+
"js-yaml": "^4.1.1",
|
|
159
|
+
"jsdoc-type-pratt-parser": "^4.1.0",
|
|
160
|
+
"json-buffer": "^3.0.1",
|
|
161
|
+
"json-schema-traverse": "^0.4.1",
|
|
162
|
+
"json-stable-stringify-without-jsonify": "^1.0.1",
|
|
163
|
+
"json5": "^1.0.2",
|
|
164
|
+
"jsx-ast-utils": "^3.3.5",
|
|
165
|
+
"keyv": "^4.5.4",
|
|
166
|
+
"language-subtag-registry": "^0.3.23",
|
|
167
|
+
"language-tags": "^1.0.9",
|
|
168
|
+
"levn": "^0.4.1",
|
|
169
|
+
"locate-path": "^6.0.0",
|
|
170
|
+
"lodash.merge": "^4.6.2",
|
|
171
|
+
"loose-envify": "^1.4.0",
|
|
172
|
+
"math-intrinsics": "^1.1.0",
|
|
173
|
+
"minimatch": "^3.1.2",
|
|
174
|
+
"minimist": "^1.2.8",
|
|
175
|
+
"ms": "^2.1.3",
|
|
176
|
+
"natural-compare": "^1.4.0",
|
|
177
|
+
"object-assign": "^4.1.1",
|
|
178
|
+
"object-inspect": "^1.13.4",
|
|
179
|
+
"object-keys": "^1.1.1",
|
|
180
|
+
"object.assign": "^4.1.7",
|
|
181
|
+
"object.entries": "^1.1.9",
|
|
182
|
+
"object.fromentries": "^2.0.8",
|
|
183
|
+
"object.groupby": "^1.0.3",
|
|
184
|
+
"object.values": "^1.2.1",
|
|
185
|
+
"optionator": "^0.9.4",
|
|
186
|
+
"own-keys": "^1.0.1",
|
|
187
|
+
"p-limit": "^3.1.0",
|
|
188
|
+
"p-locate": "^5.0.0",
|
|
189
|
+
"parent-module": "^1.0.1",
|
|
190
|
+
"parse-imports-exports": "^0.2.4",
|
|
191
|
+
"parse-statements": "^1.0.11",
|
|
192
|
+
"path-exists": "^4.0.0",
|
|
193
|
+
"path-key": "^3.1.1",
|
|
194
|
+
"path-parse": "^1.0.7",
|
|
195
|
+
"picomatch": "^4.0.3",
|
|
196
|
+
"possible-typed-array-names": "^1.1.0",
|
|
197
|
+
"prelude-ls": "^1.2.1",
|
|
198
|
+
"prettier-linter-helpers": "^1.0.1",
|
|
199
|
+
"prop-types": "^15.8.1",
|
|
200
|
+
"punycode": "^2.3.1",
|
|
201
|
+
"react-is": "^16.13.1",
|
|
202
|
+
"reflect.getprototypeof": "^1.0.10",
|
|
203
|
+
"regexp-tree": "^0.1.27",
|
|
204
|
+
"regexp.prototype.flags": "^1.5.4",
|
|
205
|
+
"resolve": "^1.22.11",
|
|
206
|
+
"resolve-from": "^4.0.0",
|
|
207
|
+
"safe-array-concat": "^1.1.3",
|
|
208
|
+
"safe-push-apply": "^1.0.0",
|
|
209
|
+
"safe-regex": "^2.1.1",
|
|
210
|
+
"safe-regex-test": "^1.1.0",
|
|
211
|
+
"semver": "^7.7.3",
|
|
212
|
+
"set-function-length": "^1.2.2",
|
|
213
|
+
"set-function-name": "^2.0.2",
|
|
214
|
+
"set-proto": "^1.0.0",
|
|
215
|
+
"shebang-command": "^2.0.0",
|
|
216
|
+
"shebang-regex": "^3.0.0",
|
|
217
|
+
"side-channel": "^1.1.0",
|
|
218
|
+
"side-channel-list": "^1.0.0",
|
|
219
|
+
"side-channel-map": "^1.0.1",
|
|
220
|
+
"side-channel-weakmap": "^1.0.2",
|
|
221
|
+
"spdx-exceptions": "^2.5.0",
|
|
222
|
+
"spdx-expression-parse": "^4.0.0",
|
|
223
|
+
"spdx-license-ids": "^3.0.22",
|
|
224
|
+
"stop-iteration-iterator": "^1.1.0",
|
|
225
|
+
"string.prototype.includes": "^2.0.1",
|
|
226
|
+
"string.prototype.matchall": "^4.0.12",
|
|
227
|
+
"string.prototype.repeat": "^1.0.0",
|
|
228
|
+
"string.prototype.trim": "^1.2.10",
|
|
229
|
+
"string.prototype.trimend": "^1.0.9",
|
|
230
|
+
"string.prototype.trimstart": "^1.0.8",
|
|
231
|
+
"strip-bom": "^3.0.0",
|
|
232
|
+
"strip-json-comments": "^3.1.1",
|
|
233
|
+
"supports-color": "^7.2.0",
|
|
234
|
+
"supports-preserve-symlinks-flag": "^1.0.0",
|
|
235
|
+
"synckit": "^0.11.11",
|
|
236
|
+
"tinyglobby": "^0.2.15",
|
|
237
|
+
"ts-api-utils": "^2.4.0",
|
|
238
|
+
"tsconfig-paths": "^3.15.0",
|
|
239
|
+
"type-check": "^0.4.0",
|
|
240
|
+
"typed-array-buffer": "^1.0.3",
|
|
241
|
+
"typed-array-byte-length": "^1.0.3",
|
|
242
|
+
"typed-array-byte-offset": "^1.0.4",
|
|
243
|
+
"typed-array-length": "^1.0.7",
|
|
244
|
+
"typescript": "^5.9.3",
|
|
245
|
+
"unbox-primitive": "^1.1.0",
|
|
246
|
+
"uri-js": "^4.4.1",
|
|
247
|
+
"which": "^2.0.2",
|
|
248
|
+
"which-boxed-primitive": "^1.1.1",
|
|
249
|
+
"which-builtin-type": "^1.2.1",
|
|
250
|
+
"which-collection": "^1.0.2",
|
|
251
|
+
"which-typed-array": "^1.1.19",
|
|
252
|
+
"word-wrap": "^1.2.5",
|
|
253
|
+
"yocto-queue": "^0.1.0"
|
|
254
|
+
},
|
|
255
|
+
"devDependencies": {
|
|
256
|
+
"@eslint/js": "^9.39.2",
|
|
257
|
+
"eslint": "^9.39.2",
|
|
258
|
+
"eslint-config-prettier": "^10.1.8",
|
|
259
|
+
"eslint-plugin-import": "^2.32.0",
|
|
260
|
+
"eslint-plugin-jsx-a11y": "^6.10.0",
|
|
261
|
+
"eslint-plugin-jsdoc": "^50.2.2",
|
|
262
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
263
|
+
"eslint-plugin-react": "^7.37.5",
|
|
264
|
+
"eslint-plugin-security": "^3.0.1",
|
|
265
|
+
"globals": "^17.0.0",
|
|
266
|
+
"prettier": "^3.7.4",
|
|
267
|
+
"typescript-eslint": "^8.51.0"
|
|
268
|
+
},
|
|
269
|
+
"peerDependencies": {
|
|
270
|
+
"@eslint/js": "^9.22.0",
|
|
271
|
+
"eslint": "^9.22.0",
|
|
272
|
+
"eslint-config-prettier": "^10.1.8",
|
|
273
|
+
"eslint-plugin-import": "^2.32.0",
|
|
274
|
+
"eslint-plugin-jsx-a11y": "^6.10.0",
|
|
275
|
+
"eslint-plugin-jsdoc": "^50.2.2",
|
|
276
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
277
|
+
"eslint-plugin-react": "^7.37.5",
|
|
278
|
+
"eslint-plugin-security": "^3.0.1",
|
|
279
|
+
"globals": "^17.0.0",
|
|
280
|
+
"prettier": "^3.7.4",
|
|
281
|
+
"typescript-eslint": "^8.28.0"
|
|
282
|
+
},
|
|
283
|
+
"engines": {
|
|
284
|
+
"node": ">=18.0.0"
|
|
285
|
+
},
|
|
286
|
+
"publishConfig": {
|
|
287
|
+
"access": "public"
|
|
288
|
+
}
|
|
289
|
+
}
|