eslint-config-reverentgeek 5.5.3 → 6.0.0
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 +31 -36
- package/blog.js +3 -2
- package/browser.js +12 -11
- package/common.js +26 -24
- package/eslint.config.js +12 -12
- package/esm.js +6 -7
- package/node-esm.js +13 -11
- package/node.js +17 -13
- package/package.json +4 -3
- package/react.js +6 -6
- package/utils.js +18 -0
package/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD010 -->
|
|
1
2
|
# eslint-config-reverentgeek
|
|
2
3
|
|
|
3
4
|
This package is [ReverentGeek's](https://twitter.com/reverentgeek) preferred configuration settings for [eslint](https://eslint.org/).
|
|
@@ -6,9 +7,9 @@ This package is [ReverentGeek's](https://twitter.com/reverentgeek) preferred con
|
|
|
6
7
|
|
|
7
8
|
1. Install dependencies.
|
|
8
9
|
|
|
9
|
-
```sh
|
|
10
|
-
npm install --save-dev eslint eslint-config-reverentgeek
|
|
11
|
-
```
|
|
10
|
+
```sh
|
|
11
|
+
npm install --save-dev eslint eslint-config-reverentgeek
|
|
12
|
+
```
|
|
12
13
|
|
|
13
14
|
2. Create an `eslint.config.js` file.
|
|
14
15
|
3. Add the following to the config file.
|
|
@@ -18,7 +19,7 @@ npm install --save-dev eslint eslint-config-reverentgeek
|
|
|
18
19
|
|
|
19
20
|
const rgConfig = require( "eslint-config-reverentgeek" );
|
|
20
21
|
module.exports = [
|
|
21
|
-
|
|
22
|
+
rgConfig.configs.common,
|
|
22
23
|
{
|
|
23
24
|
rules: {
|
|
24
25
|
}
|
|
@@ -28,52 +29,48 @@ module.exports = [
|
|
|
28
29
|
|
|
29
30
|
## Alternative Configs
|
|
30
31
|
|
|
31
|
-
The
|
|
32
|
+
The _node-esm_ config adds specific support for Node.js and ES modules (`import`/`export`).
|
|
32
33
|
|
|
33
34
|
```js
|
|
34
|
-
|
|
35
|
+
import rg from "eslint-config-reverentgeek";
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
...rgConfig.configs.browser,
|
|
39
|
-
...rgConfig.configs.blog,
|
|
37
|
+
export default [
|
|
38
|
+
rg.configs["node-esm"],
|
|
40
39
|
{
|
|
41
40
|
rules: {
|
|
41
|
+
"n/no-unpublished-import": [ "error", { allowModules: [ "eslint-config-reverentgeek" ] } ]
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
];
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
The
|
|
47
|
+
The _blog_ config changes the code style to two-spaced indentions, which is better for copying code samples to blog posts.
|
|
48
48
|
|
|
49
49
|
```js
|
|
50
50
|
"use strict";
|
|
51
51
|
|
|
52
52
|
const rgConfig = require( "eslint-config-reverentgeek" );
|
|
53
53
|
module.exports = [
|
|
54
|
-
|
|
54
|
+
rgConfig.configs.browser,
|
|
55
|
+
rgConfig.configs.blog,
|
|
55
56
|
{
|
|
56
57
|
rules: {
|
|
57
|
-
"n/no-unpublished-require": [ "error", {
|
|
58
|
-
allowModules: [ "eslint-config-reverentgeek" ]
|
|
59
|
-
} ]
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
];
|
|
63
61
|
```
|
|
64
62
|
|
|
65
|
-
The
|
|
63
|
+
The _node_ config adds specific support for Node.js and CommonJS modules.
|
|
66
64
|
|
|
67
65
|
```js
|
|
68
|
-
|
|
66
|
+
"use strict";
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
const rgConfig = require( "eslint-config-reverentgeek" );
|
|
69
|
+
module.exports = [
|
|
70
|
+
rgConfig.configs.node,
|
|
72
71
|
{
|
|
73
72
|
rules: {
|
|
74
|
-
"n/no-unpublished-
|
|
75
|
-
allowModules: [ "eslint-config-reverentgeek" ]
|
|
76
|
-
} ]
|
|
73
|
+
"n/no-unpublished-require": [ "error", { allowModules: [ "eslint-config-reverentgeek" ] } ]
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
76
|
];
|
|
@@ -90,16 +87,14 @@ import rg from "eslint-config-reverentgeek";
|
|
|
90
87
|
import react from "eslint-plugin-react";
|
|
91
88
|
|
|
92
89
|
export default [
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
rg.configs.browser,
|
|
91
|
+
rg.configs.react,
|
|
95
92
|
{
|
|
96
93
|
plugins: {
|
|
97
94
|
react,
|
|
98
95
|
},
|
|
99
96
|
rules: {
|
|
100
|
-
"n/no-unpublished-import": [ "error", {
|
|
101
|
-
allowModules: [ "eslint-config-reverentgeek" ]
|
|
102
|
-
} ]
|
|
97
|
+
"n/no-unpublished-import": [ "error", { allowModules: [ "eslint-config-reverentgeek" ] } ]
|
|
103
98
|
}
|
|
104
99
|
}
|
|
105
100
|
];
|
|
@@ -112,7 +107,7 @@ The _browser_ config sets the `browser` environment and adds ES module support.
|
|
|
112
107
|
|
|
113
108
|
const rgConfig = require( "eslint-config-reverentgeek" );
|
|
114
109
|
module.exports = [
|
|
115
|
-
|
|
110
|
+
rgConfig.configs.browser,
|
|
116
111
|
{
|
|
117
112
|
rules: {
|
|
118
113
|
}
|
|
@@ -124,16 +119,16 @@ module.exports = [
|
|
|
124
119
|
|
|
125
120
|
1. Install dependencies.
|
|
126
121
|
|
|
127
|
-
```sh
|
|
128
|
-
npm install --save-dev eslint@8 eslint-config-reverentgeek@4
|
|
129
|
-
```
|
|
122
|
+
```sh
|
|
123
|
+
npm install --save-dev eslint@8 eslint-config-reverentgeek@4
|
|
124
|
+
```
|
|
130
125
|
|
|
131
126
|
2. Create an `.eslintrc.js` file.
|
|
132
127
|
3. Add the following to the config file.
|
|
133
128
|
|
|
134
129
|
```js
|
|
135
130
|
module.exports = {
|
|
136
|
-
|
|
131
|
+
extends: [ "reverentgeek" ]
|
|
137
132
|
};
|
|
138
133
|
```
|
|
139
134
|
|
|
@@ -143,7 +138,7 @@ The _blog_ rule set changes to code style to two-spaced indentions, which is bet
|
|
|
143
138
|
|
|
144
139
|
```js
|
|
145
140
|
module.exports = {
|
|
146
|
-
|
|
141
|
+
extends: [ "reverentgeek/blog" ]
|
|
147
142
|
};
|
|
148
143
|
```
|
|
149
144
|
|
|
@@ -153,7 +148,7 @@ The _node_ rule set adds specific support for Node.js and CommonJS modules.
|
|
|
153
148
|
"use strict";
|
|
154
149
|
|
|
155
150
|
module.exports = {
|
|
156
|
-
|
|
151
|
+
extends: [ "reverentgeek/node" ]
|
|
157
152
|
};
|
|
158
153
|
```
|
|
159
154
|
|
|
@@ -163,7 +158,7 @@ The _node/module_ rule set adds specific support for Node.js and ES modules (`im
|
|
|
163
158
|
"use strict";
|
|
164
159
|
|
|
165
160
|
module.exports = {
|
|
166
|
-
|
|
161
|
+
extends: [ "reverentgeek/node/module" ]
|
|
167
162
|
};
|
|
168
163
|
```
|
|
169
164
|
|
|
@@ -171,6 +166,6 @@ The _browser_ rule set the `browser` environment and adds ES module support.
|
|
|
171
166
|
|
|
172
167
|
```js
|
|
173
168
|
module.exports = {
|
|
174
|
-
|
|
169
|
+
extends: [ "reverentgeek/browser" ]
|
|
175
170
|
};
|
|
176
171
|
```
|
package/blog.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const styles = require( "@stylistic/eslint-plugin" );
|
|
3
3
|
|
|
4
|
-
module.exports =
|
|
4
|
+
module.exports = {
|
|
5
5
|
plugins: {
|
|
6
6
|
"@stylistic": styles
|
|
7
7
|
},
|
|
@@ -9,4 +9,5 @@ module.exports = [ {
|
|
|
9
9
|
"no-console": [ "off" ],
|
|
10
10
|
"@stylistic/indent": [ "error", 2 ]
|
|
11
11
|
}
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
|
package/browser.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const globals = require( "globals" );
|
|
3
3
|
const common = require( "./common" );
|
|
4
|
+
const { merge } = require( "./utils" );
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
rules: {
|
|
14
|
-
}
|
|
6
|
+
const config = {
|
|
7
|
+
languageOptions: {
|
|
8
|
+
ecmaVersion: "latest",
|
|
9
|
+
sourceType: "module",
|
|
10
|
+
globals: globals.browser
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
15
13
|
}
|
|
16
|
-
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports = merge( common, config );
|
|
17
|
+
|
package/common.js
CHANGED
|
@@ -2,29 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
const eslint = require( "@eslint/js" );
|
|
4
4
|
const styles = require( "@stylistic/eslint-plugin" );
|
|
5
|
+
const { merge } = require( "./utils" );
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"@stylistic/space-in-parens": [ "error", "always" ],
|
|
27
|
-
"@stylistic/template-curly-spacing": [ "error", "always" ]
|
|
28
|
-
}
|
|
7
|
+
const config = {
|
|
8
|
+
name: "reverentgeek-common",
|
|
9
|
+
rules: {
|
|
10
|
+
"no-console": [ "off" ],
|
|
11
|
+
"no-var": [ "error" ],
|
|
12
|
+
"@stylistic/array-bracket-spacing": [ "error", "always", { singleValue: true } ],
|
|
13
|
+
"@stylistic/comma-dangle": [ "error", "never" ],
|
|
14
|
+
"@stylistic/comma-spacing": [ "error", { before: false, after: true } ],
|
|
15
|
+
"@stylistic/eol-last": [ "error", "always" ],
|
|
16
|
+
"@stylistic/indent": [ "error", "tab" ],
|
|
17
|
+
"@stylistic/linebreak-style": [ "error", "unix" ],
|
|
18
|
+
"@stylistic/no-multiple-empty-lines": [ "error", { max: 1 } ],
|
|
19
|
+
"@stylistic/no-tabs": [ "error", { allowIndentationTabs: true } ],
|
|
20
|
+
"@stylistic/no-trailing-spaces": [ "error", { skipBlankLines: false, ignoreComments: false } ],
|
|
21
|
+
"@stylistic/object-curly-spacing": [ "error", "always" ],
|
|
22
|
+
"@stylistic/quote-props": [ "error", "as-needed" ],
|
|
23
|
+
"@stylistic/quotes": [ "error", "double" ],
|
|
24
|
+
"@stylistic/semi": [ "error", "always" ],
|
|
25
|
+
"@stylistic/space-in-parens": [ "error", "always" ],
|
|
26
|
+
"@stylistic/template-curly-spacing": [ "error", "always" ]
|
|
29
27
|
}
|
|
30
|
-
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const merged = merge( eslint.configs.recommended, styles.configs.recommended, config );
|
|
31
|
+
|
|
32
|
+
module.exports = merged;
|
package/eslint.config.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const node = require( "./node" );
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
allowModules: [ "@eslint/js" ]
|
|
13
|
-
} ]
|
|
14
|
-
}
|
|
4
|
+
const config = {
|
|
5
|
+
rules: {
|
|
6
|
+
"n/no-unpublished-require": [ "error", {
|
|
7
|
+
allowModules: [ "globals", "eslint-plugin-n", "@stylistic/eslint-plugin" ]
|
|
8
|
+
} ],
|
|
9
|
+
"n/no-extraneous-require": [ "error", {
|
|
10
|
+
allowModules: [ "@eslint/js" ]
|
|
11
|
+
} ]
|
|
15
12
|
}
|
|
16
|
-
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
module.exports = [ node, config ];
|
|
16
|
+
|
package/esm.js
CHANGED
package/node-esm.js
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
const common = require( "./common" );
|
|
3
3
|
const nodePlugin = require( "eslint-plugin-n" );
|
|
4
4
|
const nodeRecommended = nodePlugin.configs["flat/recommended-module"];
|
|
5
|
+
const { merge } = require( "./utils" );
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
rules: {
|
|
14
|
-
"n/exports-style": [ "error" ]
|
|
15
|
-
}
|
|
7
|
+
const config = {
|
|
8
|
+
name: "reverentgeek-node-esm",
|
|
9
|
+
languageOptions: {
|
|
10
|
+
sourceType: "module"
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
"n/exports-style": [ "error" ]
|
|
16
14
|
}
|
|
17
|
-
|
|
15
|
+
};
|
|
16
|
+
const merged = merge( common, nodeRecommended, config );
|
|
17
|
+
|
|
18
|
+
module.exports = merged;
|
|
19
|
+
|
package/node.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
+
|
|
1
2
|
"use strict";
|
|
2
3
|
const common = require( "./common" );
|
|
3
4
|
const nodePlugin = require( "eslint-plugin-n" );
|
|
4
|
-
const nodeRecommended = nodePlugin.configs["flat/recommended"];
|
|
5
|
+
const nodeRecommended = nodePlugin.configs["flat/recommended-script"];
|
|
6
|
+
const { merge } = require( "./utils" );
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
strict: [ "error", "global" ],
|
|
15
|
-
"n/exports-style": [ "error" ]
|
|
16
|
-
}
|
|
8
|
+
const config = {
|
|
9
|
+
name: "reverentgeek-node-commonjs",
|
|
10
|
+
languageOptions: {
|
|
11
|
+
sourceType: "commonjs"
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
strict: [ "error", "global" ],
|
|
15
|
+
"n/exports-style": [ "error" ]
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const merged = merge( common, nodeRecommended, config );
|
|
20
|
+
|
|
21
|
+
module.exports = merged;
|
|
22
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-reverentgeek",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "ESLint rules that ReverentGeek likes :)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@stylistic/eslint-plugin": "^5.2.1",
|
|
22
22
|
"eslint-plugin-n": "^17.7.0",
|
|
23
|
-
"globals": "^16.2.0"
|
|
23
|
+
"globals": "^16.2.0",
|
|
24
|
+
"mergician": "^2.0.2"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"eslint": "^9.34.0"
|
|
27
28
|
}
|
|
28
|
-
}
|
|
29
|
+
}
|
package/react.js
CHANGED
package/utils.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// merge-configs.js
|
|
3
|
+
// Utility to merge ESLint config objects for name, plugins, languageOptions, and rules
|
|
4
|
+
|
|
5
|
+
function merge( ...configs ) {
|
|
6
|
+
const languageOptions = {
|
|
7
|
+
sourceType: configs.map( cfg => cfg?.languageOptions?.sourceType ).filter( Boolean ).pop(),
|
|
8
|
+
globals: Object.assign( {}, ...configs.map( cfg => cfg?.languageOptions?.globals || {} ) )
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
name: configs.map( cfg => cfg?.name ).filter( Boolean ).pop(),
|
|
12
|
+
plugins: Object.assign( {}, ...configs.map( cfg => cfg?.plugins || {} ) ),
|
|
13
|
+
languageOptions,
|
|
14
|
+
rules: Object.assign( {}, ...configs.map( cfg => cfg?.rules || {} ) )
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = { merge };
|