Skip to content

Commit 17fbedd

Browse files
committed
add eslint config
1 parent bcbd1fa commit 17fbedd

File tree

7 files changed

+1758
-229
lines changed

7 files changed

+1758
-229
lines changed

eslint.config.mjs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
import shopifyEslintPlugin from '@shopify/eslint-plugin';
5+
import vitest from '@vitest/eslint-plugin';
6+
import { includeIgnoreFile } from '@eslint/compat';
7+
8+
// https://eslint.org/docs/latest/use/configure/ignore#including-gitignore-files
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
const gitignorePath = path.resolve(__dirname, '.gitignore');
12+
13+
const config = [
14+
...shopifyEslintPlugin.configs.typescript,
15+
...shopifyEslintPlugin.configs['typescript-type-checking'],
16+
...shopifyEslintPlugin.configs.node,
17+
includeIgnoreFile(gitignorePath),
18+
{
19+
languageOptions: {
20+
parserOptions: {
21+
project: 'tsconfig.json',
22+
},
23+
},
24+
rules: {
25+
'@typescript-eslint/consistent-type-definitions': 'off',
26+
'@typescript-eslint/naming-convention': 'off',
27+
// use the upstream config, but relax reporting newlines for now
28+
'import/order': [
29+
'error',
30+
{
31+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling'],
32+
'newlines-between': 'ignore',
33+
},
34+
],
35+
'import/no-cycle': 'off',
36+
'import/no-extraneous-dependencies': 'off',
37+
'id-length': 'off',
38+
curly: ['error', 'multi-line', 'consistent'],
39+
},
40+
},
41+
{
42+
files: ['**/*.spec.ts'],
43+
plugins: { vitest },
44+
rules: {
45+
...vitest.configs.recommended.rules,
46+
},
47+
},
48+
];
49+
50+
export default config;

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"dev:web": "yarn --cwd packages/vscode-extension dev:web",
2727
"format": "prettier --write \"packages/*/src/**/*.ts\"",
2828
"format:check": "prettier --check --ignore-unknown \"packages/*/src/**/*.ts\"",
29+
"lint": "eslint packages --ignore-pattern 'packages/prettier-plugin-liquid/*'",
2930
"playground": "yarn --cwd packages/codemirror-language-client run dev:playground",
3031
"prebuild:ts": "rm -rf packages/*/dist",
3132
"publish:vsce": "yarn --cwd packages/vscode-extension publish:vsce",
@@ -38,8 +39,12 @@
3839
},
3940
"devDependencies": {
4041
"@changesets/cli": "^2.26.0",
42+
"@eslint/compat": "^1.2.6",
43+
"@shopify/eslint-plugin": "^47.0.1",
44+
"@vitest/eslint-plugin": "^1.1.30",
4145
"copy-webpack-plugin": "^11.0.0",
4246
"css-loader": "^6.7.3",
47+
"eslint": "^9.20.1",
4348
"html-webpack-plugin": "^5.5.0",
4449
"jsdom": "^22.1.0",
4550
"prettier": "^2.8.4",

packages/vscode-extension/.eslintrc.js

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

packages/vscode-extension/.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.vscode/
22
.github/
33
.DS_Store
4-
.eslintrc.js
54
.projections.json
65
.gitignore
76
.gitmodules
@@ -12,6 +11,7 @@ images/*.gif
1211
CONTRIBUTING.md
1312
CODE_OF_CONDUCT.md
1413
RELEASING.md
14+
eslint.config.mjs
1515
webpack.config.js
1616
theme-check-vscode*.vsix
1717
yarn.lock
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line import/extensions
2+
export { default } from '../../eslint.config.mjs';

packages/vscode-extension/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dev:web": "yarn build && vscode-test-web --permission=clipboard-read --permission=clipboard-write --browserType=chromium --extensionDevelopmentPath=.",
4444
"format": "prettier --write 'src/**/*.{ts,js}'",
4545
"format:check": "prettier --check 'src/**/*.{js,ts}'",
46-
"lint": "eslint src --ext ts",
46+
"lint": "eslint src",
4747
"package": "vsce package --no-dependencies $npm_package_version",
4848
"postinstall": "yarn --cwd ./syntaxes install",
4949
"prebuild": "rimraf dist language-configuration.json",
@@ -74,14 +74,11 @@
7474
"@types/node": "16.x",
7575
"@types/prettier": "^2.4.2",
7676
"@types/vscode": "^1.85.0",
77-
"@typescript-eslint/eslint-plugin": "^5.45.0",
78-
"@typescript-eslint/parser": "^5.45.0",
7977
"@vscode/test-electron": "^2.2.0",
8078
"@vscode/test-web": "^0.0.62",
8179
"@vscode/vsce": "^2.21.0",
8280
"chai": "^4.3.4",
83-
"eslint": "^8.28.0",
84-
"eslint-config-prettier": "^8.3.0",
81+
"eslint": "^9.20.1",
8582
"rimraf": "^3.0.2",
8683
"vscode-test": "^1.3.0"
8784
},

0 commit comments

Comments
 (0)