Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';

import shopifyEslintPlugin from '@shopify/eslint-plugin';
import vitest from '@vitest/eslint-plugin';
import { includeIgnoreFile } from '@eslint/compat';

// https://eslint.org/docs/latest/use/configure/ignore#including-gitignore-files
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');

const config = [
...shopifyEslintPlugin.configs.typescript,
...shopifyEslintPlugin.configs['typescript-type-checking'],
...shopifyEslintPlugin.configs.node,

// @shopify/eslint-plugin requires prettier 3+!
// we can manually disable problematic rules instead.
{
rules: {
'@shopify/class-property-semi': 'off',
'@shopify/binary-assignment-parens': 'off',
'prefer-arrow-callback': 'off',
'arrow-body-style': 'off',
},
},

includeIgnoreFile(gitignorePath),
{
languageOptions: {
parserOptions: {
project: 'tsconfig.json',
},
},
rules: {
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/naming-convention': 'off',
// use the upstream config, but relax reporting newlines for now
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling'],
'newlines-between': 'ignore',
},
],
'import/no-cycle': 'off',
'import/no-extraneous-dependencies': 'off',
'id-length': 'off',
curly: ['error', 'multi-line', 'consistent'],
},
},
{
// if we want to *enforce* rather than relax any ts-eslint rules, the config
// block's `files` needs to be a subset of the upstream `files` scope for
// which the ts-eslint plugin is defined. otherwise eslint will crash :(
// https://github.com/Shopify/web-configs/blob/main/packages/eslint-plugin/lib/config/typescript.js
// one of several spooky-action-at-a-distance footguns of the new flat config!
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/no-shadow': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
},
{
files: ['**/*.spec.ts'],
plugins: { vitest },
rules: {
...vitest.configs.recommended.rules,
},
},
];

export default config;
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"dev:web": "yarn --cwd packages/vscode-extension dev:web",
"format": "prettier --write \"packages/*/src/**/*.ts\"",
"format:check": "prettier --check --ignore-unknown \"packages/*/src/**/*.ts\"",
"lint": "eslint packages --ignore-pattern 'packages/prettier-plugin-liquid/*'",
"playground": "yarn --cwd packages/codemirror-language-client run dev:playground",
"prebuild:ts": "rm -rf packages/*/dist",
"publish:vsce": "yarn --cwd packages/vscode-extension publish:vsce",
Expand All @@ -38,8 +39,12 @@
},
"devDependencies": {
"@changesets/cli": "^2.26.0",
"@eslint/compat": "^1.2.6",
"@shopify/eslint-plugin": "^47.0.1",
"@vitest/eslint-plugin": "^1.1.30",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"eslint": "^9.20.1",
"html-webpack-plugin": "^5.5.0",
"jsdom": "^22.1.0",
"prettier": "^2.8.4",
Expand Down
22 changes: 0 additions & 22 deletions packages/vscode-extension/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/vscode-extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.vscode/
.github/
.DS_Store
.eslintrc.js
.projections.json
.gitignore
.gitmodules
Expand All @@ -12,6 +11,7 @@ images/*.gif
CONTRIBUTING.md
CODE_OF_CONDUCT.md
RELEASING.md
eslint.config.mjs
webpack.config.js
theme-check-vscode*.vsix
yarn.lock
Expand Down
2 changes: 2 additions & 0 deletions packages/vscode-extension/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line import/extensions
export { default } from '../../eslint.config.mjs';
7 changes: 2 additions & 5 deletions packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dev:web": "yarn build && vscode-test-web --permission=clipboard-read --permission=clipboard-write --browserType=chromium --extensionDevelopmentPath=.",
"format": "prettier --write 'src/**/*.{ts,js}'",
"format:check": "prettier --check 'src/**/*.{js,ts}'",
"lint": "eslint src --ext ts",
"lint": "eslint src",
"package": "vsce package --no-dependencies $npm_package_version",
"postinstall": "yarn --cwd ./syntaxes install",
"prebuild": "rimraf dist language-configuration.json",
Expand Down Expand Up @@ -74,14 +74,11 @@
"@types/node": "16.x",
"@types/prettier": "^2.4.2",
"@types/vscode": "^1.85.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@vscode/test-electron": "^2.2.0",
"@vscode/test-web": "^0.0.62",
"@vscode/vsce": "^2.21.0",
"chai": "^4.3.4",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.3.0",
"eslint": "^9.20.1",
"rimraf": "^3.0.2",
"vscode-test": "^1.3.0"
},
Expand Down
Loading
Loading