@singlepixellab/eslint-config 1.2.1 → 2.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 +57 -4
- package/eslint.config.js +3 -3
- package/index.js +7 -16
- package/package.json +44 -11
- package/rules/react.js +6 -12
- package/.editorconfig +0 -11
- package/.github/workflows/publish.yml +0 -21
- package/.vscode/extensions.json +0 -7
- package/.vscode/settings.json +0 -8
package/README.md
CHANGED
|
@@ -2,12 +2,65 @@
|
|
|
2
2
|
|
|
3
3
|
The ESLint rules and configs used by Single Pixel Lab.
|
|
4
4
|
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js ≥ 18
|
|
8
|
+
- ESLint ≥ 9
|
|
9
|
+
|
|
5
10
|
## Usage
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
Install package
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
npm install -dev @singlepixellab/eslint-config eslint
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This package provides a default configuration as well as modular rule sets that can be composed as needed.
|
|
19
|
+
|
|
20
|
+
### Default configuration
|
|
21
|
+
|
|
22
|
+
You can use the full configuration directly:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import config from "@singlepixellab/eslint-config";
|
|
26
|
+
|
|
27
|
+
export default config;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Modular configurations
|
|
31
|
+
|
|
32
|
+
Each rule set can also be imported individually using subpath exports.
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import react from "@singlepixellab/eslint-config/react";
|
|
36
|
+
import styles from "@singlepixellab/eslint-config/styles";
|
|
37
|
+
|
|
38
|
+
export default [...styles, ...react];
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Available modules:
|
|
42
|
+
|
|
43
|
+
| Module | Import | Description |
|
|
44
|
+
| -------- | ---------------------------------------- | ------------------------------ |
|
|
45
|
+
| Core | `@singlepixellab/eslint-config/core` | Base ESLint rules |
|
|
46
|
+
| Ignore | `@singlepixellab/eslint-config/ignores` | Default ignore patterns |
|
|
47
|
+
| Import | `@singlepixellab/eslint-config/imports` | Import ordering and validation |
|
|
48
|
+
| JSDoc | `@singlepixellab/eslint-config/jsdoc` | JSDoc linting |
|
|
49
|
+
| Prettier | `@singlepixellab/eslint-config/prettier` | Prettier integration |
|
|
50
|
+
| React | `@singlepixellab/eslint-config/react` | React and Hooks rules |
|
|
51
|
+
| Style | `@singlepixellab/eslint-config/styles` | Stylistic rules |
|
|
52
|
+
|
|
53
|
+
### Named exports
|
|
54
|
+
|
|
55
|
+
Alternatively, the same configurations can be imported from the package entry.
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import { reactConfig, stylesConfig } from "@singlepixellab/eslint-config";
|
|
59
|
+
|
|
60
|
+
export default [...stylesConfig, ...reactConfig];
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Named exports are provided for convenience, while subpath imports are generally recommended for clarity and tree-shaking.
|
|
11
64
|
|
|
12
65
|
## VS Code
|
|
13
66
|
|
package/eslint.config.js
CHANGED
|
@@ -11,9 +11,6 @@ export default [
|
|
|
11
11
|
// Global ignores should always be first
|
|
12
12
|
...ignores,
|
|
13
13
|
|
|
14
|
-
// styles: @stylistic/eslint-plugin
|
|
15
|
-
...styles,
|
|
16
|
-
|
|
17
14
|
// eslint-plugin-import
|
|
18
15
|
...imports,
|
|
19
16
|
|
|
@@ -25,6 +22,9 @@ export default [
|
|
|
25
22
|
|
|
26
23
|
...core,
|
|
27
24
|
|
|
25
|
+
// styles: @stylistic/eslint-plugin
|
|
26
|
+
...styles,
|
|
27
|
+
|
|
28
28
|
// Prettier should be last to have the opportunity to override other configs
|
|
29
29
|
...prettier,
|
|
30
30
|
];
|
package/index.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import config from "./eslint.config.js";
|
|
2
|
-
import core from "./rules/core.js";
|
|
3
|
-
import ignores from "./rules/ignores.js";
|
|
4
|
-
import imports from "./rules/imports.js";
|
|
5
|
-
import jsdoc from "./rules/jsdoc.js";
|
|
6
|
-
import prettier from "./rules/prettier.js";
|
|
7
|
-
import react from "./rules/react.js";
|
|
8
|
-
import styles from "./rules/styles.js";
|
|
9
2
|
|
|
10
3
|
export default config;
|
|
11
4
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
styles,
|
|
20
|
-
};
|
|
5
|
+
export { default as coreConfig } from "./rules/core.js";
|
|
6
|
+
export { default as ignoresConfig } from "./rules/ignores.js";
|
|
7
|
+
export { default as importsConfig } from "./rules/imports.js";
|
|
8
|
+
export { default as jsdocConfig } from "./rules/jsdoc.js";
|
|
9
|
+
export { default as prettierConfig } from "./rules/prettier.js";
|
|
10
|
+
export { default as reactConfig } from "./rules/react.js";
|
|
11
|
+
export { default as stylesConfig } from "./rules/styles.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singlepixellab/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "The ESLint rules and configs used by Single Pixel Lab",
|
|
5
5
|
"author": "Single Pixel Lab",
|
|
6
6
|
"keywords": [
|
|
@@ -19,9 +19,42 @@
|
|
|
19
19
|
"bugs": {
|
|
20
20
|
"url": "https://github.com/singlepixellab/eslint-config/issues"
|
|
21
21
|
},
|
|
22
|
-
"main": "index.js",
|
|
23
22
|
"type": "module",
|
|
24
23
|
"prettier": "@singlepixellab/prettier-config",
|
|
24
|
+
"files": [
|
|
25
|
+
"index.js",
|
|
26
|
+
"eslint.config.js",
|
|
27
|
+
"rules"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"import": "./index.js"
|
|
32
|
+
},
|
|
33
|
+
"./core": {
|
|
34
|
+
"import": "./rules/core.js"
|
|
35
|
+
},
|
|
36
|
+
"./ignores": {
|
|
37
|
+
"import": "./rules/ignores.js"
|
|
38
|
+
},
|
|
39
|
+
"./imports": {
|
|
40
|
+
"import": "./rules/imports.js"
|
|
41
|
+
},
|
|
42
|
+
"./jsdoc": {
|
|
43
|
+
"import": "./rules/jsdoc.js"
|
|
44
|
+
},
|
|
45
|
+
"./prettier": {
|
|
46
|
+
"import": "./rules/prettier.js"
|
|
47
|
+
},
|
|
48
|
+
"./react": {
|
|
49
|
+
"import": "./rules/react.js"
|
|
50
|
+
},
|
|
51
|
+
"./styles": {
|
|
52
|
+
"import": "./rules/styles.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=18"
|
|
57
|
+
},
|
|
25
58
|
"peerDependencies": {
|
|
26
59
|
"eslint": ">= 9"
|
|
27
60
|
},
|
|
@@ -32,20 +65,20 @@
|
|
|
32
65
|
"inspect": "eslint --inspect-config"
|
|
33
66
|
},
|
|
34
67
|
"devDependencies": {
|
|
35
|
-
"@singlepixellab/prettier-config": "^1.
|
|
36
|
-
"eslint": "^9.
|
|
37
|
-
"prettier": "^3.
|
|
68
|
+
"@singlepixellab/prettier-config": "^1.2.0",
|
|
69
|
+
"eslint": "^9.39.4",
|
|
70
|
+
"prettier": "^3.8.1"
|
|
38
71
|
},
|
|
39
72
|
"dependencies": {
|
|
40
|
-
"@eslint/js": "^9.
|
|
41
|
-
"@stylistic/eslint-plugin": "^5.
|
|
73
|
+
"@eslint/js": "^9.39.4",
|
|
74
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
42
75
|
"eslint-config-prettier": "^10.1.8",
|
|
43
76
|
"eslint-plugin-import": "^2.32.0",
|
|
44
|
-
"eslint-plugin-jsdoc": "^
|
|
77
|
+
"eslint-plugin-jsdoc": "^62.7.1",
|
|
45
78
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
46
|
-
"eslint-plugin-prettier": "^5.5.
|
|
79
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
47
80
|
"eslint-plugin-react": "^7.37.5",
|
|
48
|
-
"eslint-plugin-react-hooks": "^
|
|
49
|
-
"globals": "^
|
|
81
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
82
|
+
"globals": "^17.4.0"
|
|
50
83
|
}
|
|
51
84
|
}
|
package/rules/react.js
CHANGED
|
@@ -53,19 +53,16 @@ export default [
|
|
|
53
53
|
"react/jsx-boolean-value": ["error", "never", { always: [] }],
|
|
54
54
|
|
|
55
55
|
// Validate closing bracket location in JSX
|
|
56
|
-
"react/jsx-closing-bracket-location":
|
|
56
|
+
"react/jsx-closing-bracket-location": "off",
|
|
57
57
|
|
|
58
58
|
// Validate closing tag location in JSX
|
|
59
|
-
"react/jsx-closing-tag-location": "
|
|
59
|
+
"react/jsx-closing-tag-location": "off",
|
|
60
60
|
|
|
61
61
|
// Enforce or disallow spaces inside of curly braces in JSX attributes
|
|
62
|
-
"react/jsx-curly-spacing":
|
|
63
|
-
"error",
|
|
64
|
-
{ when: "never", allowMultiline: true },
|
|
65
|
-
],
|
|
62
|
+
"react/jsx-curly-spacing": "off",
|
|
66
63
|
|
|
67
64
|
// Enforce or disallow spaces around equal sign
|
|
68
|
-
"react/jsx-equals-spacing":
|
|
65
|
+
"react/jsx-equals-spacing": "off",
|
|
69
66
|
|
|
70
67
|
// No jsx extension
|
|
71
68
|
// https://github.com/facebook/create-react-app/issues/87#issuecomment-234627904
|
|
@@ -78,13 +75,10 @@ export default [
|
|
|
78
75
|
"react/jsx-handler-names": "off",
|
|
79
76
|
|
|
80
77
|
// Validate props indentation in JSX
|
|
81
|
-
"react/jsx-indent-props":
|
|
78
|
+
"react/jsx-indent-props": "off",
|
|
82
79
|
|
|
83
80
|
// Limit maximum of props on a single line in JSX
|
|
84
|
-
"react/jsx-max-props-per-line":
|
|
85
|
-
"error",
|
|
86
|
-
{ maximum: 1, when: "multiline" },
|
|
87
|
-
],
|
|
81
|
+
"react/jsx-max-props-per-line": "off",
|
|
88
82
|
|
|
89
83
|
// Prevent usage of .bind() in JSX props
|
|
90
84
|
"react/jsx-no-bind": [
|
package/.editorconfig
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: Publish Package to npmjs
|
|
2
|
-
on:
|
|
3
|
-
release:
|
|
4
|
-
types: [published]
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
id-token: write
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v4
|
|
13
|
-
# Setup .npmrc file to publish to npm
|
|
14
|
-
- uses: actions/setup-node@v4
|
|
15
|
-
with:
|
|
16
|
-
node-version: '20.x'
|
|
17
|
-
registry-url: 'https://registry.npmjs.org'
|
|
18
|
-
- run: npm ci
|
|
19
|
-
- run: npm publish --provenance --access public
|
|
20
|
-
env:
|
|
21
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.vscode/extensions.json
DELETED