Skip to content

Commit d75a579

Browse files
committed
Patch ESLint in standalone build to make tree shaking easier, update build config and tests.
1 parent 9074613 commit d75a579

File tree

8 files changed

+49
-15
lines changed

8 files changed

+49
-15
lines changed

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default tseslint.config(
7272
globals: globals.browser,
7373
},
7474
rules: {
75-
...solid.configs['flat/recommended'].rules,
75+
...solid.configs["flat/recommended"].rules,
7676
"@typescript-eslint/ban-ts-comment": 0,
7777
"@typescript-eslint/no-unused-vars": 0,
7878
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
},
8383
"lint-staged": {
8484
"*!(test).{js,jsx,ts,tsx}": [
85-
"eslint --ignore-pattern test/fixture/invalid --fix",
85+
"pnpm lint --fix",
8686
"prettier --write"
8787
]
8888
},

standalone/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Linter } from "eslint";
2-
import parser from "@typescript-eslint/parser";
3-
import plugin from "../dist";
1+
import { Linter } from "eslint/linter";
2+
import * as parser from "@typescript-eslint/parser";
3+
import plugin from "../dist/index.js";
44
import { version as pluginVersion } from "../package.json";
55
import memoizeOne from "memoize-one";
66

77
// Create linter instance
8-
const linter = new Linter();
8+
const linter = new Linter({ configType: "flat" });
99

1010
const getConfig = memoizeOne((ruleSeverityOverrides) => {
1111
const config = [

standalone/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,10 @@
3838
},
3939
"dependencies": {
4040
"@types/eslint": "^8.56.7"
41+
},
42+
"pnpm": {
43+
"patchedDependencies": {
44+
"eslint@8.57.0": "patches/eslint@8.57.0.patch"
45+
}
4146
}
4247
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/package.json b/package.json
2+
index a51b58b2444f41ead8b445f27003245b451f5728..48820932d33a3671c07e0f909017a2894d3ace06 100644
3+
--- a/package.json
4+
+++ b/package.json
5+
@@ -10,7 +10,8 @@
6+
"exports": {
7+
"./package.json": "./package.json",
8+
".": "./lib/api.js",
9+
- "./use-at-your-own-risk": "./lib/unsupported-api.js"
10+
+ "./use-at-your-own-risk": "./lib/unsupported-api.js",
11+
+ "./linter": "./lib/linter/index.js"
12+
},
13+
"scripts": {
14+
"build:docs:update-links": "node tools/fetch-docs-links.js",
15+
@@ -175,5 +176,6 @@
16+
"license": "MIT",
17+
"engines": {
18+
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
19+
- }
20+
+ },
21+
+ "sideEffects": false
22+
}

standalone/pnpm-lock.yaml

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone/rollup.config.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ export default {
4949
},
5050
{
5151
// assert for web
52-
match: /^assert$/u,
52+
match: /^(node:)?assert$/u,
5353
target: "./mock/assert.js",
5454
},
5555
{
5656
// path for web
57-
match: /^path$|^path\/posix$/u,
57+
match: /^(node:)?path$|^path\/posix$/u,
5858
target: "./mock/path.js",
5959
},
6060
{
6161
// util for web
62-
match: /^util$/u,
62+
match: /^(node:)?util$/u,
6363
target: "./mock/util.js",
6464
},
6565
{

standalone/test.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ assert.equal(typeof __dirname, 'undefined');
4242
assert.equal(typeof plugin, "object");
4343
assert.equal(typeof pluginVersion, "string");
4444
assert.equal(typeof eslintVersion, "string");
45+
assert.equal(eslintVersion[0], '8')
4546
assert.equal(typeof verify, "function");
4647
assert.equal(typeof verifyAndFix, "function");
4748
@@ -77,7 +78,7 @@ const linker = (specifier) => {
7778
"dist.js": dist,
7879
}[specifier];
7980
if (!mod) {
80-
throw new Error("can't import other modules");
81+
throw new Error(`can't import other modules: ${specifier}`);
8182
}
8283
return mod;
8384
};

0 commit comments

Comments
 (0)