Skip to content

Commit

Permalink
feat: upgrade eslint
Browse files Browse the repository at this point in the history
Co-authored-by: ygqygq2 <[email protected]>
  • Loading branch information
ygqygq2 committed Apr 21, 2024
1 parent dc5454e commit b3ade34
Show file tree
Hide file tree
Showing 43 changed files with 937 additions and 992 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

22 changes: 0 additions & 22 deletions .eslintrc.json

This file was deleted.

14 changes: 14 additions & 0 deletions .vscode-test-debug.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// .vscode-test-debug.mjs
import { defineConfig } from '@vscode/test-cli';

export default defineConfig([
{
label: 'suiteTests',
files: 'out/test/suite/*.test.js',
version: '1.88.0',
mocha: {
ui: 'bdd',
require: ['ts-node/register', 'tsconfig-paths/register'],
}
},
]);
16 changes: 12 additions & 4 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
// .vscode-test.mjs
import { defineConfig } from '@vscode/test-cli';
import path from 'path';

// suiteTests 使用 vscode-test 测试,当前无法直接支持 ts,它需要编译成js
// unitTests 直接使用 mocha 测试,直接使用 ts
const workspacePath = path.resolve('sampleWorkspace', 'test.code-workspace');

// suiteTests 使用 vscode-test/mocha 测试,当前无法直接支持 ts,它需要编译成js
// unitTests 使用 vitest 测试,直接使用 ts
export default defineConfig([
{
label: 'suiteTests',
files: 'out/test/suite/*.test.js',
version: '1.88.0',
mocha: {
ui: 'tdd',
timeout: 20000,
ui: 'bdd',
require: ['ts-node/register', 'tsconfig-paths/register'],
},
launchArgs: [workspacePath]
.concat(['--skip-welcome'])
.concat(['--disable-extensions'])
.concat(['--skip-release-notes'])
.concat(['--enable-proposed-api']),
},
]);
29 changes: 29 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import eslint from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{
files: ['**/*.ts'],
plugins:{
['simple-import-sort']: simpleImportSortPlugin,
}
},
{ ignores: ['sampleWorkspace', 'out', 'dist', '**/*.d.ts'] },
eslint.configs.recommended,
...tseslint.configs.recommended,
eslintPluginPrettierRecommended,
{
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'warn',
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'prettier/prettier': 'warn'
},
},
);
60 changes: 37 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,54 +141,68 @@
]
},
"scripts": {
"vscode:prepublish": "rm -rf out && npm run esbuild-base -- --minify",
"vscode:prepublish": "npm run clean && npm run esbuild-base -- --minify",
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --format=cjs --platform=node",
"esbuild": "npm run esbuild-base -- --sourcemap",
"esbuild-watch": "npm run esbuild-base -- --sourcemap --watch",
"watch": "npm run esbuild --watch",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts --fix",
"lint": "eslint src ",
"lint-fix": "eslint --fix src",
"compile": "npm run esbuild-base -- --sourcemap",
"package": "vsce package --no-dependencies",
"publish": "vsce publish --no-dependencies",
"test": "tsc -p ./ && vscode-test",
"clean": "rimraf out/",
"test-compile": "npm run clean && tsc -p ./ && npm run compile",
"test": "npm run test-compile && vscode-test",
"test-grep": "vscode-test -f",
"test:suite:mocha": "tsc -p ./ && node out/test/runTests.js",
"test:suite": "vitest suite --watch=false",
"test:unit": "vitest unit --watch=false",
"test:coverage": "vitest run --coverage"
"test:coverage": "vitest run --coverage",
"prepush": "pnpm run lint",
"postinstall": "simple-git-hooks",
"preinstall": "npx only-allow pnpm"
},
"devDependencies": {
"@types/chai": "^4.3.11",
"@eslint/js": "^9.1.1",
"@types/chai": "^4.3.14",
"@types/fs-extra": "^11.0.4",
"@types/glob": "^8.1.0",
"@types/lodash": "^4.14.202",
"@types/lodash": "^4.17.0",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.13",
"@types/node": "^20.12.7",
"@types/sinon": "^17.0.3",
"@types/tmp": "^0.2.6",
"@types/vscode": "^1.85.0",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@vitest/coverage-v8": "^1.2.2",
"@vscode/test-cli": "^0.0.4",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"@vitest/coverage-v8": "^1.5.0",
"@vscode/test-cli": "^0.0.9",
"@vscode/test-electron": "^2.3.9",
"chai": "^5.0.3",
"chai": "^5.1.0",
"cross-env": "^7.0.3",
"esbuild": "^0.20.0",
"eslint": "^8.56.0",
"esbuild": "^0.20.2",
"eslint": "^9.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unused-imports": "^3.0.0",
"expect-type": "^0.17.3",
"glob": "^10.3.10",
"jest-mock-vscode": "^2.1.1",
"eslint-plugin-simple-import-sort": "^12.1.0",
"expect-type": "^0.19.0",
"fs-extra": "^11.2.0",
"glob": "^10.3.12",
"jest-mock-vscode": "^3.0.2",
"lodash": "^4.17.21",
"mocha": "^10.2.0",
"prettier": "^3.2.4",
"mocha": "^10.4.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"sinon": "^17.0.1",
"tmp": "^0.2.3",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.3",
"vite": "^5.0.13",
"vitest": "^1.2.2"
"typescript": "^5.4.5",
"typescript-eslint": "^7.7.0",
"vite": "^5.2.10",
"vitest": "^1.5.0"
},
"license": "SEE LICENSE IN LICENSE.txt",
"bugs": {
Expand Down
Loading

0 comments on commit b3ade34

Please sign in to comment.