@pob/eslint-config 67.7.0 → 67.8.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/lib/index.js +7 -0
- package/lib/oxlint.test.js +18 -0
- package/lib/plugins/import/import-base.js +2 -2
- package/lib/plugins/regexp.js +2 -2
- package/oxlint/base.json +34 -0
- package/oxlint/module.json +11 -0
- package/package.json +3 -1
package/lib/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import tseslint from "typescript-eslint";
|
|
4
4
|
import oxlintBaseConfig from "../oxlint/base.json" with { type: "json" };
|
|
5
|
+
import oxlintModuleConfig from "../oxlint/module.json" with { type: "json" };
|
|
5
6
|
import oxlintNodeConfig from "../oxlint/node.json" with { type: "json" };
|
|
6
7
|
import oxlintTypescriptConfig from "../oxlint/typescript.json" with { type: "json" };
|
|
7
8
|
import baseConfigs from "./_base.js";
|
|
@@ -64,6 +65,11 @@ const oxlintrc = fs.existsSync(oxlintrcPath)
|
|
|
64
65
|
const oxlintTypescript =
|
|
65
66
|
oxlintrc?.includes("@pob/eslint-config/oxlint/typescript.json") ?? false;
|
|
66
67
|
|
|
68
|
+
// module.json is extended by ES module projects (not configs.nodeCommonjs),
|
|
69
|
+
// once regenerated by pob: until then its rules stay in eslint.
|
|
70
|
+
const oxlintModule =
|
|
71
|
+
oxlintrc?.includes("@pob/eslint-config/oxlint/module.json") ?? false;
|
|
72
|
+
|
|
67
73
|
// node.json is extended by projects using the node configs, once regenerated
|
|
68
74
|
// by pob: until then its rules stay in eslint.
|
|
69
75
|
const oxlintNode =
|
|
@@ -73,6 +79,7 @@ const oxlintNode =
|
|
|
73
79
|
const oxlintSharedConfigs = oxlintrc
|
|
74
80
|
? [
|
|
75
81
|
oxlintBaseConfig,
|
|
82
|
+
...(oxlintModule ? [oxlintModuleConfig] : []),
|
|
76
83
|
...(oxlintNode ? [oxlintNodeConfig] : []),
|
|
77
84
|
...(oxlintTypescript ? [oxlintTypescriptConfig] : []),
|
|
78
85
|
]
|
package/lib/oxlint.test.js
CHANGED
|
@@ -5,6 +5,7 @@ import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
|
5
5
|
import { lintWithOxlint, oxlintConfigsDir } from "./test-utils/oxlint.js";
|
|
6
6
|
|
|
7
7
|
const baseConfigPath = path.join(oxlintConfigsDir, "base.json");
|
|
8
|
+
const moduleConfigPath = path.join(oxlintConfigsDir, "module.json");
|
|
8
9
|
const nodeConfigPath = path.join(oxlintConfigsDir, "node.json");
|
|
9
10
|
const typescriptConfigPath = path.join(oxlintConfigsDir, "typescript.json");
|
|
10
11
|
// this repo's config, the options are not in base.json so projects keep
|
|
@@ -86,6 +87,23 @@ describe("oxlint/base.json", () => {
|
|
|
86
87
|
});
|
|
87
88
|
});
|
|
88
89
|
|
|
90
|
+
describe("oxlint/module.json", () => {
|
|
91
|
+
const project = useProject({}, [baseConfigPath, moduleConfigPath]);
|
|
92
|
+
const commonjs = "exports.a = 1;\n";
|
|
93
|
+
|
|
94
|
+
it("reports CommonJS in ES modules", async () => {
|
|
95
|
+
expect(summarize(await lint(project.cwd, commonjs, "file.js"))).toEqual([
|
|
96
|
+
{ line: 1, rule: "import(no-commonjs)" },
|
|
97
|
+
]);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// like the eslint configs, which apply commonjs rules to .cjs files
|
|
101
|
+
it("allows CommonJS in .cjs files", async () => {
|
|
102
|
+
await rm(path.join(project.cwd, "file.js"));
|
|
103
|
+
expect(await lint(project.cwd, commonjs, "file.cjs")).toEqual([]);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
89
107
|
describe("oxlint/node.json", () => {
|
|
90
108
|
const project = useProject({}, [baseConfigPath, nodeConfigPath]);
|
|
91
109
|
const commonjs = '"use strict";\n';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createNodeResolver, flatConfigs } from "eslint-plugin-import-x";
|
|
2
2
|
|
|
3
3
|
export default [
|
|
4
|
-
|
|
4
|
+
flatConfigs.recommended,
|
|
5
5
|
{
|
|
6
6
|
name: "@pob/eslint-config/import/base",
|
|
7
7
|
// override recommended language options
|
package/lib/plugins/regexp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { configs } from "eslint-plugin-regexp";
|
|
2
2
|
|
|
3
3
|
export default [
|
|
4
4
|
{
|
|
5
|
-
...
|
|
5
|
+
...configs["flat/recommended"],
|
|
6
6
|
name: "eslint-plugin-regexp/flat/recommended",
|
|
7
7
|
},
|
|
8
8
|
// {
|
package/oxlint/base.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"categories": {
|
|
3
3
|
"correctness": "off"
|
|
4
4
|
},
|
|
5
|
+
"plugins": ["import"],
|
|
5
6
|
"rules": {
|
|
6
7
|
"array-callback-return": [
|
|
7
8
|
"error",
|
|
@@ -686,6 +687,26 @@
|
|
|
686
687
|
}
|
|
687
688
|
],
|
|
688
689
|
"symbol-description": "error",
|
|
690
|
+
"import/first": "error",
|
|
691
|
+
"import/named": "error",
|
|
692
|
+
"import/namespace": "error",
|
|
693
|
+
"import/newline-after-import": "error",
|
|
694
|
+
"import/no-absolute-path": "error",
|
|
695
|
+
"import/no-cycle": [
|
|
696
|
+
"error",
|
|
697
|
+
{
|
|
698
|
+
"ignoreTypes": true
|
|
699
|
+
}
|
|
700
|
+
],
|
|
701
|
+
"import/no-duplicates": "error",
|
|
702
|
+
"import/no-dynamic-require": "error",
|
|
703
|
+
"import/no-empty-named-blocks": "error",
|
|
704
|
+
"import/no-mutable-exports": "error",
|
|
705
|
+
"import/no-named-as-default": "error",
|
|
706
|
+
"import/no-named-as-default-member": "error",
|
|
707
|
+
"import/no-named-default": "error",
|
|
708
|
+
"import/no-self-import": "error",
|
|
709
|
+
"import/no-webpack-loader-syntax": "error",
|
|
689
710
|
"unicorn/catch-error-name": [
|
|
690
711
|
"error",
|
|
691
712
|
{
|
|
@@ -918,6 +939,19 @@
|
|
|
918
939
|
"no-with": "off",
|
|
919
940
|
"prefer-promise-reject-errors": "off",
|
|
920
941
|
"require-await": "off",
|
|
942
|
+
"import/named": "off",
|
|
943
|
+
"import/no-anonymous-default-export": [
|
|
944
|
+
"error",
|
|
945
|
+
{
|
|
946
|
+
"allowArray": true,
|
|
947
|
+
"allowArrowFunction": false,
|
|
948
|
+
"allowAnonymousClass": false,
|
|
949
|
+
"allowAnonymousFunction": false,
|
|
950
|
+
"allowCallExpression": true,
|
|
951
|
+
"allowLiteral": true,
|
|
952
|
+
"allowObject": true
|
|
953
|
+
}
|
|
954
|
+
],
|
|
921
955
|
"unicorn/prefer-array-find": "off",
|
|
922
956
|
"unicorn/prefer-string-slice": "off",
|
|
923
957
|
"unicorn/prefer-string-starts-ends-with": "off"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pob/eslint-config",
|
|
3
|
-
"version": "67.
|
|
3
|
+
"version": "67.8.0",
|
|
4
4
|
"description": "eslint config files",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/christophehurpeau/pob",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"oxlint/allow-unsafe.json",
|
|
22
22
|
"oxlint/app.json",
|
|
23
23
|
"oxlint/base.json",
|
|
24
|
+
"oxlint/module.json",
|
|
24
25
|
"oxlint/node.json",
|
|
25
26
|
"oxlint/typescript.json",
|
|
26
27
|
"utils.js"
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"./oxlint/allow-unsafe-as-warn.json": "./oxlint/allow-unsafe-as-warn.json",
|
|
40
41
|
"./oxlint/app.json": "./oxlint/app.json",
|
|
41
42
|
"./oxlint/base.json": "./oxlint/base.json",
|
|
43
|
+
"./oxlint/module.json": "./oxlint/module.json",
|
|
42
44
|
"./oxlint/node.json": "./oxlint/node.json",
|
|
43
45
|
"./oxlint/typescript.json": "./oxlint/typescript.json",
|
|
44
46
|
"./utils": "./utils.js",
|