@robot-inventor/eslint-config 11.1.10 → 12.0.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 +2 -33
- package/dist/index.js +27 -7
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -12,42 +12,25 @@ npm install --save-dev @robot-inventor/eslint-config
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
Add the following to your
|
|
15
|
+
Add the following to your `eslint.config.js` file:
|
|
16
16
|
|
|
17
17
|
```javascript
|
|
18
|
-
// ESModule
|
|
19
18
|
import { eslintConfig } from "@robot-inventor/eslint-config";
|
|
20
19
|
|
|
21
20
|
export default eslintConfig;
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
// CommonJS
|
|
26
|
-
const { eslintConfig } = require("@robot-inventor/eslint-config");
|
|
27
|
-
|
|
28
|
-
module.exports = eslintConfig;
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
If you don't need JSDoc rules, you can use the ``eslintConfigNoJSDoc`` instead.
|
|
23
|
+
If you don't need JSDoc rules, you can use the `eslintConfigNoJSDoc` instead.
|
|
32
24
|
|
|
33
25
|
```javascript
|
|
34
|
-
// ESModule
|
|
35
26
|
import { eslintConfigNoJSDoc } from "@robot-inventor/eslint-config";
|
|
36
27
|
|
|
37
28
|
export default eslintConfigNoJSDoc;
|
|
38
29
|
```
|
|
39
30
|
|
|
40
|
-
```javascript
|
|
41
|
-
// CommonJS
|
|
42
|
-
const { eslintConfigNoJSDoc } = require("@robot-inventor/eslint-config");
|
|
43
|
-
|
|
44
|
-
module.exports = eslintConfigNoJSDoc;
|
|
45
|
-
```
|
|
46
|
-
|
|
47
31
|
You can extend or override the config as needed.
|
|
48
32
|
|
|
49
33
|
```javascript
|
|
50
|
-
// ESModule
|
|
51
34
|
import { eslintConfig } from "@robot-inventor/eslint-config";
|
|
52
35
|
|
|
53
36
|
export default [
|
|
@@ -59,17 +42,3 @@ export default [
|
|
|
59
42
|
}
|
|
60
43
|
];
|
|
61
44
|
```
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
// CommonJS
|
|
65
|
-
const { eslintConfig } = require("@robot-inventor/eslint-config");
|
|
66
|
-
|
|
67
|
-
module.exports = [
|
|
68
|
-
...eslintConfig,
|
|
69
|
-
{
|
|
70
|
-
rules: {
|
|
71
|
-
// Your rules here
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
];
|
|
75
|
-
```
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { defineConfig } from "eslint/config";
|
|
2
|
+
import eslintReactKit, {} from "@eslint-react/kit";
|
|
2
3
|
import { flatConfigs as importXFlatConfigs } from "eslint-plugin-import-x";
|
|
3
4
|
import $nextPlugin from "@next/eslint-plugin-next";
|
|
5
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
4
6
|
import eslint from "@eslint/js";
|
|
5
7
|
import eslintConfigPrettier from "eslint-config-prettier";
|
|
8
|
+
import eslintReact from "@eslint-react/eslint-plugin";
|
|
6
9
|
import jsdoc from "eslint-plugin-jsdoc";
|
|
7
|
-
import react from "eslint-plugin-react";
|
|
8
10
|
import reactCompiler from "eslint-plugin-react-compiler";
|
|
9
11
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
12
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
10
13
|
// eslint-disable-next-line import-x/max-dependencies
|
|
11
14
|
import { configs as tseslintConfigs } from "typescript-eslint";
|
|
12
15
|
const eslintRules = {
|
|
@@ -103,11 +106,29 @@ const JSDocRule = defineConfig({
|
|
|
103
106
|
}
|
|
104
107
|
});
|
|
105
108
|
const eslintConfig = defineConfig(...eslintConfigNoJSDoc, ...JSDocRule);
|
|
109
|
+
const jsxBooleanValue = () => (context, { ast }) => ({
|
|
110
|
+
JSXAttribute(node) {
|
|
111
|
+
const { value } = node;
|
|
112
|
+
// Guard: must have expression value
|
|
113
|
+
if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer)
|
|
114
|
+
return;
|
|
115
|
+
// Guard: must be literal true
|
|
116
|
+
const expression = ast.unwrap(value.expression);
|
|
117
|
+
if (expression.type !== AST_NODE_TYPES.Literal || expression.value !== true)
|
|
118
|
+
return;
|
|
119
|
+
context.report({
|
|
120
|
+
node,
|
|
121
|
+
message: "Omit the value for boolean attributes.",
|
|
122
|
+
fix: (fixer) => fixer.removeRange([node.name.range[1], value.range[1]])
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
106
126
|
const eslintReactConfigBase = defineConfig(reactHooks.configs.flat["recommended-latest"], {
|
|
107
|
-
files: ["**/*.tsx"],
|
|
108
|
-
|
|
127
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
128
|
+
extends: [eslintReact.configs.recommended, eslintReactKit().use(jsxBooleanValue).getConfig()],
|
|
109
129
|
plugins: {
|
|
110
|
-
...
|
|
130
|
+
...eslintReact.configs.recommended.plugins,
|
|
131
|
+
"@stylistic": stylistic,
|
|
111
132
|
"react-compiler": reactCompiler
|
|
112
133
|
},
|
|
113
134
|
rules: {
|
|
@@ -117,15 +138,14 @@ const eslintReactConfigBase = defineConfig(reactHooks.configs.flat["recommended-
|
|
|
117
138
|
definedTags: ["jsxImportSource"]
|
|
118
139
|
}
|
|
119
140
|
],
|
|
120
|
-
"
|
|
141
|
+
"@stylistic/jsx-self-closing-comp": [
|
|
121
142
|
"error",
|
|
122
143
|
{
|
|
123
144
|
component: true,
|
|
124
145
|
html: true
|
|
125
146
|
}
|
|
126
147
|
],
|
|
127
|
-
"
|
|
128
|
-
"react/jsx-curly-brace-presence": ["error", "never"],
|
|
148
|
+
"@stylistic/jsx-curly-brace-presence": ["error", "never"],
|
|
129
149
|
"react-compiler/react-compiler": "error"
|
|
130
150
|
}
|
|
131
151
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robot-inventor/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
"description": "My ESLint config preset",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -33,20 +33,23 @@
|
|
|
33
33
|
"provenance": true
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@eslint/
|
|
37
|
-
"@
|
|
38
|
-
"eslint": "^
|
|
36
|
+
"@eslint-react/eslint-plugin": "^5.7.3",
|
|
37
|
+
"@eslint-react/kit": "^5.7.3",
|
|
38
|
+
"@eslint/js": "^10.0.1",
|
|
39
|
+
"@next/eslint-plugin-next": "^16.2.5",
|
|
40
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
41
|
+
"@typescript-eslint/types": "^8.59.2",
|
|
42
|
+
"eslint": "^10.3.0",
|
|
39
43
|
"eslint-config-prettier": "^10.1.8",
|
|
40
44
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
41
45
|
"eslint-plugin-import-x": "^4.16.2",
|
|
42
46
|
"eslint-plugin-jsdoc": "^62.9.0",
|
|
43
|
-
"eslint-plugin-react": "^7.37.5",
|
|
44
47
|
"eslint-plugin-react-compiler": "^19.0.0-beta-ebf51a3-20250411",
|
|
45
48
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
46
|
-
"typescript-eslint": "^8.
|
|
49
|
+
"typescript-eslint": "^8.59.2"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {
|
|
49
|
-
"@changesets/changelog-github": "^0.
|
|
52
|
+
"@changesets/changelog-github": "^0.7.0",
|
|
50
53
|
"@changesets/cli": "^2.31.0",
|
|
51
54
|
"@eslint-types/jsdoc": "^48.2.2",
|
|
52
55
|
"@eslint-types/typescript-eslint": "^7.5.0",
|