Skip to content

Commit 3fc2ba8

Browse files
authored
chore: migrate to custom eslint plugin to check local import extensions (#2590)
* chore: migrate to custom eslint plugin to check local import extensions
1 parent 122ade5 commit 3fc2ba8

5 files changed

Lines changed: 23 additions & 118 deletions

File tree

.oxlintrc.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "./node_modules/oxlint/configuration_schema.json",
33
"plugins": ["import", "oxc", "typescript"],
4-
"jsPlugins": ["eslint-plugin-cypress"],
4+
"jsPlugins": ["eslint-plugin-cypress", "eslint-plugin-local-import-ext"],
55
"env": {
66
"es2025": true,
77
"browser": true,
@@ -62,9 +62,17 @@
6262
"typescript/no-non-null-assertion": "off",
6363
"typescript/no-unused-expressions": "off",
6464
"typescript/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "destructuredArrayIgnorePattern": "^_", "caughtErrors": "none" }],
65-
// blocked by https://github.com/oxc-project/oxc/issues/19431
66-
// use "lint:local-js-imports" npm script in the meantime to catch any missing local JS imports
65+
// "import/extensions" rule is blocked by https://github.com/oxc-project/oxc/issues/19431
66+
// use custom "eslint-plugin-import-ext" custom eslint plugin in the meantime to catch any missing local import file extensions
6767
"import/extensions": "off",
68+
"local-import-ext/require-local-extension": [
69+
"error",
70+
{
71+
"js": "always",
72+
"ts": "never",
73+
"excludedFolders": ["demos/aurelia/test", "demos/react/test", "demos/vue/test", "frameworks/angular-slickgrid", "test"]
74+
}
75+
],
6876
"import/no-self-import": "error",
6977
"no-async-promise-executor": "off",
7078
"oxc/erasing-op": "off",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@
4848
"roll-new-release": "pnpm build && pnpm new-version && pnpm new-publish",
4949
"build:dev": "pnpm -r --filter=vanilla-demo build:dev",
5050
"serve:vite": "pnpm -r --filter=vanilla-demo dev",
51-
"lint": "oxlint . && pnpm lint:local-js-imports",
51+
"lint": "oxlint .",
5252
"lint:fix": "oxlint . --fix",
53-
"lint:local-js-imports": "node ./scripts/lint-local-js-imports.mjs",
5453
"prettier:check": "prettier --check **/*.{html,js,ts,tsx,vue}",
5554
"prettier:write": "prettier --write **/*.{html,js,ts,tsx,vue}",
5655
"test": "vitest --config ./test/vitest.config.mts",
@@ -129,6 +128,7 @@
129128
"cypress": "catalog:",
130129
"cypress-real-events": "catalog:",
131130
"eslint-plugin-cypress": "^6.4.1",
131+
"eslint-plugin-local-import-ext": "0.2.0",
132132
"globals": "catalog:",
133133
"jsdom": "catalog:",
134134
"jsdom-global": "catalog:",

pnpm-lock.yaml

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

pnpm-workspace.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ minimumReleaseAge: 2880 # 2 days in minutes
99
minimumReleaseAgeExclude:
1010
# exclude packages that I personally maintain and are safe to use on the same day
1111
- '@lerna-lite/*'
12-
# Renovate security update: hono@4.12.18
13-
- hono@4.12.18
12+
- 'eslint-plugin-local-import-ext'
1413

1514
catalog:
1615
'@4tw/cypress-drag-drop': ^2.3.1

scripts/lint-local-js-imports.mjs

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)