@pob/eslint-config 56.1.0 → 57.1.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/CHANGELOG.md +8 -80
- package/lib/_base.js +39 -17
- package/lib/base/commonjs.js +9 -4
- package/lib/base/module.js +23 -4
- package/lib/index.js +67 -13
- package/lib/node/_base.js +10 -18
- package/lib/node/commonjs.js +14 -23
- package/lib/node/module.js +22 -30
- package/lib/plugins/import/import-base.js +105 -72
- package/lib/plugins/import/import-commonjs.js +2 -3
- package/lib/plugins/import/import-module.js +2 -3
- package/lib/plugins/unicorn.js +239 -239
- package/lib/rules/best-practices.js +12 -5
- package/lib/rules/code-quality.js +2 -3
- package/lib/rules/dev-only.js +4 -3
- package/lib/rules/errors.js +2 -3
- package/lib/rules/style.js +2 -3
- package/package.json +9 -9
- package/utils.js +1 -3
- package/lib/.eslintrc.json +0 -4
- package/lib/node-commonjs.js +0 -25
- package/lib/node-module.js +0 -25
- package/lib/root-commonjs.js +0 -6
- package/lib/root-module.js +0 -6
- package/lib/rules/modules/base.js +0 -8
- package/lib/rules/modules/commonjs.js +0 -11
- package/lib/rules/modules/esm.js +0 -25
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
3
|
+
export default {
|
|
4
|
+
name: "@pob/eslint-config/best-practices",
|
|
6
5
|
rules: {
|
|
7
6
|
// https://eslint.org/docs/rules/accessor-pairs
|
|
8
7
|
"accessor-pairs": "off",
|
|
@@ -198,6 +197,9 @@ module.exports = {
|
|
|
198
197
|
// https://eslint.org/docs/rules/no-new-object
|
|
199
198
|
"no-new-object": "error",
|
|
200
199
|
|
|
200
|
+
// disallow use of new operator with the require function
|
|
201
|
+
"no-new-require": "error",
|
|
202
|
+
|
|
201
203
|
// https://eslint.org/docs/rules/no-new-wrappers
|
|
202
204
|
"no-new-wrappers": "error",
|
|
203
205
|
|
|
@@ -343,7 +345,12 @@ module.exports = {
|
|
|
343
345
|
// https://eslint.org/docs/rules/no-unused-vars
|
|
344
346
|
"no-unused-vars": [
|
|
345
347
|
"error",
|
|
346
|
-
{
|
|
348
|
+
{
|
|
349
|
+
vars: "all",
|
|
350
|
+
args: "none",
|
|
351
|
+
caughtErrors: "none",
|
|
352
|
+
ignoreRestSiblings: true,
|
|
353
|
+
},
|
|
347
354
|
],
|
|
348
355
|
|
|
349
356
|
// https://eslint.org/docs/rules/no-use-before-define
|
package/lib/rules/dev-only.js
CHANGED
package/lib/rules/errors.js
CHANGED
package/lib/rules/style.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pob/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "57.1.0",
|
|
4
4
|
"description": "eslint config files",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Christophe Hurpeau <christophe@hurpeau.com> (http://christophe.hurpeau.com/)",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "@pob/eslint-config"
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/christophehurpeau/eslint-config-pob",
|
|
14
|
-
"type": "
|
|
14
|
+
"type": "module",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=18.12.0"
|
|
17
17
|
},
|
|
@@ -19,10 +19,6 @@
|
|
|
19
19
|
"main": "./lib/index.js",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./lib/index.js",
|
|
22
|
-
"./node-commonjs": "./lib/node-commonjs.js",
|
|
23
|
-
"./node-module": "./lib/node-module.js",
|
|
24
|
-
"./root-commonjs": "./lib/root-commonjs.js",
|
|
25
|
-
"./root-module": "./lib/root-module.js",
|
|
26
22
|
"./lib/rules/best-practices": "./lib/rules/best-practices.js",
|
|
27
23
|
"./lib/rules/code-quality": "./lib/rules/code-quality.js",
|
|
28
24
|
"./lib/rules/errors": "./lib/rules/errors.js",
|
|
@@ -39,7 +35,7 @@
|
|
|
39
35
|
],
|
|
40
36
|
"scripts": {
|
|
41
37
|
"lint": "yarn run lint:eslint",
|
|
42
|
-
"lint:eslint": "yarn ../.. run eslint --
|
|
38
|
+
"lint:eslint": "yarn ../.. run eslint --quiet @pob/eslint-config"
|
|
43
39
|
},
|
|
44
40
|
"pob": {},
|
|
45
41
|
"prettier": "@pob/root/prettier-config",
|
|
@@ -47,7 +43,10 @@
|
|
|
47
43
|
"eslint": "^8.56.0"
|
|
48
44
|
},
|
|
49
45
|
"dependencies": {
|
|
50
|
-
"@
|
|
46
|
+
"@eslint/compat": "^1.1.1",
|
|
47
|
+
"@eslint/eslintrc": "2.1.4",
|
|
48
|
+
"@eslint/js": "^8.56.0",
|
|
49
|
+
"@pob/eslint-plugin": "57.0.0",
|
|
51
50
|
"confusing-browser-globals": "^1.0.11",
|
|
52
51
|
"eslint-plugin-import": "^2.29.1",
|
|
53
52
|
"eslint-plugin-n": "^17.4.0",
|
|
@@ -57,6 +56,7 @@
|
|
|
57
56
|
"eslint": "8.57.0",
|
|
58
57
|
"eslint-plugin-import": "2.29.1",
|
|
59
58
|
"eslint-plugin-n": "17.4.0",
|
|
60
|
-
"eslint-plugin-unicorn": "52.0.0"
|
|
59
|
+
"eslint-plugin-unicorn": "52.0.0",
|
|
60
|
+
"typescript": "5.5.4"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/utils.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
const isVSCode =
|
|
4
2
|
process.argv &&
|
|
5
3
|
process.argv.some((argv) => argv.includes("dbaeumer.vscode-eslint"));
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
export const enableIfVSCode = (ruleLevel) => (isVSCode ? ruleLevel : "off");
|
package/lib/.eslintrc.json
DELETED
package/lib/node-commonjs.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: [
|
|
5
|
-
"./_base",
|
|
6
|
-
"./base/commonjs",
|
|
7
|
-
"./plugins/import/import-commonjs",
|
|
8
|
-
"./node/commonjs",
|
|
9
|
-
].map(require.resolve),
|
|
10
|
-
|
|
11
|
-
overrides: [
|
|
12
|
-
{
|
|
13
|
-
files: ["*.mjs"],
|
|
14
|
-
extends: [
|
|
15
|
-
"./_base",
|
|
16
|
-
"./base/module",
|
|
17
|
-
"./plugins/import/import-module",
|
|
18
|
-
"./node/module",
|
|
19
|
-
].map(require.resolve),
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
files: ["*.cjs"],
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
};
|
package/lib/node-module.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: [
|
|
5
|
-
"./_base",
|
|
6
|
-
"./base/module",
|
|
7
|
-
"./plugins/import/import-module",
|
|
8
|
-
"./node/module",
|
|
9
|
-
].map(require.resolve),
|
|
10
|
-
|
|
11
|
-
overrides: [
|
|
12
|
-
{
|
|
13
|
-
files: ["*.cjs"],
|
|
14
|
-
extends: [
|
|
15
|
-
"./_base",
|
|
16
|
-
"./base/commonjs",
|
|
17
|
-
"./plugins/import/import-commonjs",
|
|
18
|
-
"./node/commonjs",
|
|
19
|
-
].map(require.resolve),
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
files: ["*.mjs"],
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
};
|
package/lib/root-commonjs.js
DELETED
package/lib/root-module.js
DELETED
package/lib/rules/modules/esm.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
rules: {
|
|
5
|
-
// replaced by import/no-duplicates
|
|
6
|
-
"no-duplicate-imports": "off",
|
|
7
|
-
|
|
8
|
-
// https://eslint.org/docs/rules/no-restricted-exports
|
|
9
|
-
"no-restricted-exports": [
|
|
10
|
-
"error",
|
|
11
|
-
{
|
|
12
|
-
restrictDefaultExports: {
|
|
13
|
-
direct: false, // permits `export default` declarations
|
|
14
|
-
named: true, // restricts `export { foo as default };` declarations
|
|
15
|
-
defaultFrom: false, // permits `export { default } from 'foo';` declarations
|
|
16
|
-
namedFrom: false, // permits `export { foo as default } from 'foo';` declarations
|
|
17
|
-
namespaceFrom: true, // restricts `export * as default from 'foo';` declarations
|
|
18
|
-
},
|
|
19
|
-
restrictedNamedExports: [
|
|
20
|
-
"then", // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
};
|