From e7cb3c9bc42515f6b3c715abc34f2511a35ca375 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 14 May 2023 14:40:44 +0900 Subject: [PATCH 1/8] install pnpm and simple replace --- .devcontainer/devcontainer.json | 2 +- .github/workflows/GHPages.yml | 10 +++++----- .github/workflows/NodeCI.yml | 30 +++++++++++++++--------------- .github/workflows/Release.yml | 6 +++--- .gitignore | 2 +- .npmrc | 3 ++- package.json | 28 ++++++++++++++-------------- src/meta.ts | 2 +- tools/update-meta.ts | 2 +- 9 files changed, 43 insertions(+), 42 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bdaf3295..b3cbd214 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,7 +23,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "yarn install", + "postCreateCommand": "pnpm install", // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "node" diff --git a/.github/workflows/GHPages.yml b/.github/workflows/GHPages.yml index e6a7ad8d..fa69bbbb 100644 --- a/.github/workflows/GHPages.yml +++ b/.github/workflows/GHPages.yml @@ -28,12 +28,12 @@ jobs: - uses: actions/setup-node@v3 - name: Install And Build run: |+ - yarn install - yarn build + pnpm install + pnpm run build cd explorer-v2 - yarn install - yarn pre-build - yarn build + pnpm install + pnpm run pre-build + pnpm run build - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index bbb97885..da84c00e 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -13,11 +13,11 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Install Packages - run: yarn install + run: pnpm install - name: Lint - run: yarn lint + run: pnpm run lint - name: Build - run: yarn build + run: pnpm run build test: runs-on: ubuntu-latest strategy: @@ -30,9 +30,9 @@ jobs: with: node-version: ${{ matrix.node-version }} - name: Install Packages - run: yarn install --ignore-engines + run: pnpm install --ignore-engines - name: Test - run: yarn test + run: pnpm run test test-for-ts-eslint-v4: runs-on: ubuntu-latest strategy: @@ -46,12 +46,12 @@ jobs: node-version: ${{ matrix.node-version }} - name: Install @typescript-eslint v4 run: |+ - yarn add -D @typescript-eslint/parser@4 @typescript-eslint/eslint-plugin@4 eslint@7 --ignore-engines + pnpm run add -D @typescript-eslint/parser@4 @typescript-eslint/eslint-plugin@4 eslint@7 --ignore-engines rm -rf node_modules - name: Install Packages - run: yarn install --ignore-engines + run: pnpm install --ignore-engines - name: Test - run: yarn test + run: pnpm run test test-for-eslint-v7: runs-on: ubuntu-latest strategy: @@ -65,12 +65,12 @@ jobs: node-version: ${{ matrix.node-version }} - name: Install eslint v7 run: |+ - yarn add -D eslint@7 --ignore-engines + pnpm run add -D eslint@7 --ignore-engines rm -rf node_modules - name: Install Packages - run: yarn install --ignore-engines + run: pnpm install --ignore-engines - name: Test - run: yarn test + run: pnpm run test update-fixtures: runs-on: ubuntu-latest steps: @@ -79,9 +79,9 @@ jobs: with: node-version: 18 - name: Install Packages - run: yarn install --ignore-engines + run: pnpm install --ignore-engines - name: Update fixtures - run: yarn update-fixtures + run: pnpm run update-fixtures - name: Check changes run: | git add --all && \ @@ -92,9 +92,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Install Packages - run: yarn install --ignore-engines + run: pnpm install --ignore-engines - name: Test - run: yarn cover + run: pnpm run cover - name: Coveralls GitHub Action uses: coverallsapp/github-action@v2.1.2 with: diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 642c14d8..a5f46b35 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -27,16 +27,16 @@ jobs: node-version: 16 - name: Install Dependencies - run: yarn + run: pnpm install - name: Create Release Pull Request or Publish to npm id: changesets uses: changesets/action@v1 with: # this expects you to have a npm script called version that runs some logic and then calls `changeset version`. - version: yarn version:ci + version: pnpm run version:ci # This expects you to have a script called release which does a build for your packages and calls changeset publish - publish: yarn release + publish: pnpm run release commit: "chore: release svelte-eslint-parser" title: "chore: release svelte-eslint-parser" env: diff --git a/.gitignore b/.gitignore index f828d664..21dcf0bc 100644 --- a/.gitignore +++ b/.gitignore @@ -104,7 +104,7 @@ dist .tern-port # repo -yarn.lock +/pnpm-lock.yaml /lib /.nyc_output /coverage diff --git a/.npmrc b/.npmrc index 9cf94950..894b815a 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ -package-lock=false \ No newline at end of file +package-lock=false +enable-pre-post-scripts=true \ No newline at end of file diff --git a/package.json b/package.json index db5573b7..31ee57b6 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ ], "funding": "https://github.com/sponsors/ota-meshi", "license": "MIT", - "packageManager": "yarn@1.22.19", + "packageManager": "pnpm@7.32.4", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -25,25 +25,25 @@ "parser" ], "scripts": { - "benchmark": "yarn ts benchmark/index.ts", - "build": "yarn build:meta && yarn build:tsc", - "build:meta": "yarn ts ./tools/update-meta.ts", + "benchmark": "pnpm run ts benchmark/index.ts", + "build": "pnpm run build:meta && pnpm run build:tsc", + "build:meta": "pnpm run ts ./tools/update-meta.ts", "build:tsc": "tsc --project ./tsconfig.build.json", "clean": "rimraf .nyc_output lib coverage", - "cover": "nyc --reporter=lcov yarn test", - "debug": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", - "eslint-fix": "yarn lint --fix", + "cover": "nyc --reporter=lcov pnpm run test", + "debug": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", + "eslint-fix": "pnpm run lint --fix", "eslint-playground": "eslint tests/fixtures --ext .svelte --config .eslintrc-for-playground.js --format codeframe", "lint": "eslint . --ext .js,.ts,.json,.yaml,.yml,.svelte", - "mocha": "yarn ts ./node_modules/mocha/bin/mocha.js", - "prebuild": "yarn clean", - "prerelease": "yarn clean && yarn build", - "preversion": "yarn lint && yarn test", + "mocha": "pnpm run ts ./node_modules/mocha/bin/mocha.js", + "prebuild": "pnpm run clean", + "prerelease": "pnpm run clean && pnpm run build", + "preversion": "pnpm run lint && pnpm run test", "release": "changeset publish", - "test": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", + "test": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", "ts": "node -r esbuild-register", - "update-fixtures": "yarn ts ./tools/update-fixtures.ts", - "version:ci": "env-cmd -e version-ci yarn build:meta && changeset version" + "update-fixtures": "pnpm run ts ./tools/update-fixtures.ts", + "version:ci": "env-cmd -e version-ci pnpm run build:meta && changeset version" }, "peerDependencies": { "svelte": "^3.37.0" diff --git a/src/meta.ts b/src/meta.ts index 8096f7ad..64f705ca 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -1,5 +1,5 @@ // IMPORTANT! // This file has been automatically generated, -// in order to update its content execute "yarn build:meta" +// in order to update its content execute "pnpm run build:meta" export const name = "svelte-eslint-parser" as const; export const version = "0.28.0" as const; diff --git a/tools/update-meta.ts b/tools/update-meta.ts index 12ae96fb..8fa671ab 100644 --- a/tools/update-meta.ts +++ b/tools/update-meta.ts @@ -18,7 +18,7 @@ async function main() { `/* * IMPORTANT! * This file has been automatically generated, - * in order to update its content execute "yarn build:meta" + * in order to update its content execute "pnpm run build:meta" */ export const name = ${JSON.stringify(name)} as const; export const version = ${JSON.stringify(await getVersion())} as const; From e962620e1765fe22d12bea5d4f2119b5c4ddb159 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 14 May 2023 15:21:09 +0900 Subject: [PATCH 2/8] fix a few issues --- .eslintrc.js | 1 + explorer-v2/.prettierrc | 3 ++- package.json | 17 +++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index dc39508e..b62b4c7c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -69,6 +69,7 @@ module.exports = { "@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-explicit-any": "off", "no-implicit-globals": "off", + "no-void": ["error", { allowAsStatement: true }], }, }, { diff --git a/explorer-v2/.prettierrc b/explorer-v2/.prettierrc index ff2677ef..1a10c5f9 100644 --- a/explorer-v2/.prettierrc +++ b/explorer-v2/.prettierrc @@ -2,5 +2,6 @@ "useTabs": true, "singleQuote": true, "trailingComma": "none", - "printWidth": 100 + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"] } diff --git a/package.json b/package.json index 31ee57b6..a828af52 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "cover": "nyc --reporter=lcov pnpm run test", "debug": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", "eslint-fix": "pnpm run lint --fix", - "eslint-playground": "eslint tests/fixtures --ext .svelte --config .eslintrc-for-playground.js --format codeframe", "lint": "eslint . --ext .js,.ts,.json,.yaml,.yml,.svelte", "mocha": "pnpm run ts ./node_modules/mocha/bin/mocha.js", "prebuild": "pnpm run clean", @@ -61,12 +60,14 @@ "devDependencies": { "@changesets/changelog-github": "^0.4.6", "@changesets/cli": "^2.24.2", + "@changesets/get-release-plan": "^3.0.16", "@ota-meshi/eslint-plugin": "^0.13.0", "@types/benchmark": "^2.1.1", "@types/chai": "^4.3.0", "@types/eslint": "^8.0.0", - "@types/eslint-scope": "^3.7.0", + "@types/eslint-scope": "^3.7.4", "@types/eslint-visitor-keys": "^1.0.0", + "@types/estree": "^1.0.1", "@types/mocha": "^10.0.0", "@types/node": "^18.11.0", "@types/semver": "^7.3.9", @@ -78,17 +79,16 @@ "esbuild": "^0.17.0", "esbuild-register": "^3.3.3", "eslint": "^8.2.0", - "eslint-config-prettier": "^8.3.0", + "eslint-config-prettier": "^8.8.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-json-schema-validator": "^4.0.0", "eslint-plugin-jsonc": "^2.0.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-node-dependencies": "^0.11.0", - "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-regexp": "^1.5.0", "eslint-plugin-svelte": "^2.0.0", "eslint-plugin-svelte3": "^4.0.0", - "eslint-plugin-vue": "^9.0.0", "eslint-plugin-yml": "^1.0.0", "estree-walker": "^3.0.0", "locate-character": "^2.0.5", @@ -96,9 +96,10 @@ "mocha": "^10.0.0", "mocha-chai-jest-snapshot": "^1.1.3", "nyc": "^15.1.0", - "prettier": "^2.0.5", - "prettier-plugin-pkg": "^0.17.0", - "prettier-plugin-svelte": "^2.5.0", + "prettier": "^2.8.8", + "prettier-plugin-pkg": "^0.17.1", + "prettier-plugin-svelte": "^2.10.0", + "rimraf": "^5.0.0", "semver": "^7.3.5", "string-replace-loader": "^3.0.3", "svelte": "^3.57.0", From 3519024a31e34d44a81e4db5dc0d2823e3779481 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 14 May 2023 15:23:31 +0900 Subject: [PATCH 3/8] fix github actions --- .github/workflows/NodeCI.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index da84c00e..7cee4f3d 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 - uses: actions/setup-node@v3 - name: Install Packages run: pnpm install @@ -25,12 +26,13 @@ jobs: node-version: [12.x, 14.x, 16.x, 17.x, 18.x, 19.x] steps: - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - name: Install Packages - run: pnpm install --ignore-engines + run: pnpm install - name: Test run: pnpm run test test-for-ts-eslint-v4: @@ -40,16 +42,17 @@ jobs: node-version: [14.x] steps: - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - name: Install @typescript-eslint v4 run: |+ - pnpm run add -D @typescript-eslint/parser@4 @typescript-eslint/eslint-plugin@4 eslint@7 --ignore-engines + pnpm install -D @typescript-eslint/parser@4 @typescript-eslint/eslint-plugin@4 eslint@7 rm -rf node_modules - name: Install Packages - run: pnpm install --ignore-engines + run: pnpm install - name: Test run: pnpm run test test-for-eslint-v7: @@ -59,27 +62,29 @@ jobs: node-version: [14.x] steps: - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - name: Install eslint v7 run: |+ - pnpm run add -D eslint@7 --ignore-engines + pnpm install -D eslint@7 rm -rf node_modules - name: Install Packages - run: pnpm install --ignore-engines + run: pnpm install - name: Test run: pnpm run test update-fixtures: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 - uses: actions/setup-node@v3 with: node-version: 18 - name: Install Packages - run: pnpm install --ignore-engines + run: pnpm install - name: Update fixtures run: pnpm run update-fixtures - name: Check changes @@ -90,9 +95,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 - uses: actions/setup-node@v3 - name: Install Packages - run: pnpm install --ignore-engines + run: pnpm install - name: Test run: pnpm run cover - name: Coveralls GitHub Action From bcb33d117069e1b714fea3f626af468a5f035c23 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 14 May 2023 15:27:55 +0900 Subject: [PATCH 4/8] drop Node 12 --- .changeset/lazy-walls-reflect.md | 5 +++++ .github/workflows/NodeCI.yml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/lazy-walls-reflect.md diff --git a/.changeset/lazy-walls-reflect.md b/.changeset/lazy-walls-reflect.md new file mode 100644 index 00000000..d1122856 --- /dev/null +++ b/.changeset/lazy-walls-reflect.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +Drop Node 12 support diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index 7cee4f3d..0a00edb8 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 14.x, 16.x, 17.x, 18.x, 19.x] + node-version: [14.x, 16.x, 17.x, 18.x, 19.x] steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2 From d3c5d21b39b220984cac205af0ec038e099f7c14 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 14 May 2023 15:35:49 +0900 Subject: [PATCH 5/8] adjust deps version --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a828af52..24c00cf3 100644 --- a/package.json +++ b/package.json @@ -60,14 +60,14 @@ "devDependencies": { "@changesets/changelog-github": "^0.4.6", "@changesets/cli": "^2.24.2", - "@changesets/get-release-plan": "^3.0.16", + "@changesets/get-release-plan": "^3.0.0", "@ota-meshi/eslint-plugin": "^0.13.0", "@types/benchmark": "^2.1.1", "@types/chai": "^4.3.0", "@types/eslint": "^8.0.0", - "@types/eslint-scope": "^3.7.4", + "@types/eslint-scope": "^3.7.0", "@types/eslint-visitor-keys": "^1.0.0", - "@types/estree": "^1.0.1", + "@types/estree": "^1.0.0", "@types/mocha": "^10.0.0", "@types/node": "^18.11.0", "@types/semver": "^7.3.9", @@ -85,7 +85,7 @@ "eslint-plugin-jsonc": "^2.0.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-node-dependencies": "^0.11.0", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-regexp": "^1.5.0", "eslint-plugin-svelte": "^2.0.0", "eslint-plugin-svelte3": "^4.0.0", @@ -96,8 +96,8 @@ "mocha": "^10.0.0", "mocha-chai-jest-snapshot": "^1.1.3", "nyc": "^15.1.0", - "prettier": "^2.8.8", - "prettier-plugin-pkg": "^0.17.1", + "prettier": "^2.8.0", + "prettier-plugin-pkg": "^0.17.0", "prettier-plugin-svelte": "^2.10.0", "rimraf": "^5.0.0", "semver": "^7.3.5", From 92a644bd23fced4017c9baea3bfd12a72d3587f1 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 14 May 2023 16:51:05 +0900 Subject: [PATCH 6/8] more pnpm --- .github/workflows/GHPages.yml | 1 + .github/workflows/Release.yml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/GHPages.yml b/.github/workflows/GHPages.yml index fa69bbbb..fbf3531d 100644 --- a/.github/workflows/GHPages.yml +++ b/.github/workflows/GHPages.yml @@ -25,6 +25,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 - uses: actions/setup-node@v3 - name: Install And Build run: |+ diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index a5f46b35..d620ad3b 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -21,6 +21,9 @@ jobs: # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits fetch-depth: 0 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + - name: Setup Node.js 16 uses: actions/setup-node@v3 with: From 226f1e18f6ea337a5a8cb6c96abd974573bba85b Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 14 May 2023 16:55:26 +0900 Subject: [PATCH 7/8] back Node 12 --- .github/workflows/NodeCI.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index 0a00edb8..9b7f0278 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -23,10 +23,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x, 16.x, 17.x, 18.x, 19.x] + node-version: [12.x, 14.x, 16.x, 17.x, 18.x, 19.x] steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2 + with: + version: ${{ matrix.node-version == '12.x' && 6 || 7 }} - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: From 9e2d388c58eef71f5bcc1a2c1c0e9f8d1d43e3a3 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 14 May 2023 17:12:31 +0900 Subject: [PATCH 8/8] drop Node 12 again --- .github/workflows/NodeCI.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/NodeCI.yml b/.github/workflows/NodeCI.yml index 9b7f0278..0a00edb8 100644 --- a/.github/workflows/NodeCI.yml +++ b/.github/workflows/NodeCI.yml @@ -23,12 +23,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 14.x, 16.x, 17.x, 18.x, 19.x] + node-version: [14.x, 16.x, 17.x, 18.x, 19.x] steps: - uses: actions/checkout@v3 - uses: pnpm/action-setup@v2 - with: - version: ${{ matrix.node-version == '12.x' && 6 || 7 }} - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: