Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sveltejs/svelte-eslint-parser
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.28.0
Choose a base ref
...
head repository: sveltejs/svelte-eslint-parser
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.29.0
Choose a head ref
  • 6 commits
  • 57 files changed
  • 4 contributors

Commits on May 14, 2023

  1. chore: yarn to pnpm (#334)

    * install pnpm and simple replace
    
    * fix a few issues
    
    * fix github actions
    
    * drop Node 12
    
    * adjust deps version
    
    * more pnpm
    
    * back Node 12
    
    * drop Node 12 again
    baseballyama authored May 14, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fa4adf6 View commit details
  2. chore fix site script

    ota-meshi committed May 14, 2023
    Copy the full SHA
    4d192ef View commit details

Commits on May 17, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    180a445 View commit details

Commits on May 18, 2023

  1. fix: wrong scope for ts in bind: (#337)

    * Fix wrong scope for ts in `bind:`
    
    * Create strong-plants-suffer.md
    ota-meshi authored May 18, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    21c0dc6 View commit details
  2. feat: improve $$ vars type (#338)

    * feat: improve $$ vars type
    
    * Create flat-shrimps-type.md
    ota-meshi authored May 18, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    af55230 View commit details
  3. chore: release svelte-eslint-parser (#336)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored May 18, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    23aa59a View commit details
Showing with 59,752 additions and 117 deletions.
  1. +1 −1 .devcontainer/devcontainer.json
  2. +1 −0 .eslintrc.js
  3. +6 −5 .github/workflows/GHPages.yml
  4. +22 −16 .github/workflows/NodeCI.yml
  5. +6 −3 .github/workflows/Release.yml
  6. +1 −1 .gitignore
  7. +2 −1 .npmrc
  8. +12 −0 CHANGELOG.md
  9. +2 −1 explorer-v2/.prettierrc
  10. +2 −1 explorer-v2/build-system/pre-build/webpack.config.js
  11. +5 −2 explorer-v2/package.json
  12. +23 −22 package.json
  13. +6 −0 src/context/index.ts
  14. +0 −9 src/context/script-let.ts
  15. +2 −2 src/meta.ts
  16. +2 −2 src/parser/converts/attr.ts
  17. +3 −1 src/parser/converts/element.ts
  18. +2 −1 src/parser/index.ts
  19. +107 −1 src/parser/typescript/analyze/index.ts
  20. +4 −2 src/parser/typescript/index.ts
  21. +1 −44 src/scope/index.ts
  22. +14 −0 tests/fixtures/integrations/scope-tests/ts-scope01-input.svelte
  23. +1 −0 tests/fixtures/integrations/scope-tests/ts-scope01-output.json
  24. +24 −0 tests/fixtures/integrations/scope-tests/ts-scope01-setup.ts
  25. +5 −0 tests/fixtures/parser/ast/ts-$$props01-input.svelte
  26. +14 −0 tests/fixtures/parser/ast/ts-$$props01-no-unused-expressions-result.json
  27. +475 −0 tests/fixtures/parser/ast/ts-$$props01-output.json
  28. +8,756 −0 tests/fixtures/parser/ast/ts-$$props01-scope-output.json
  29. +5 −0 tests/fixtures/parser/ast/ts-$$props01-type-output.svelte
  30. +5 −0 tests/fixtures/parser/ast/ts-$$slots01-input.svelte
  31. +8 −0 tests/fixtures/parser/ast/ts-$$slots01-no-unused-expressions-result.json
  32. +657 −0 tests/fixtures/parser/ast/ts-$$slots01-output.json
  33. +8,686 −0 tests/fixtures/parser/ast/ts-$$slots01-scope-output.json
  34. +5 −0 tests/fixtures/parser/ast/ts-$$slots01-type-output.svelte
  35. +3 −0 tests/fixtures/parser/ast/ts-$$slots02-no-slot-input.svelte
  36. +8 −0 tests/fixtures/parser/ast/ts-$$slots02-no-slot-no-unused-expressions-result.json
  37. +422 −0 tests/fixtures/parser/ast/ts-$$slots02-no-slot-output.json
  38. +8,686 −0 tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output.json
  39. +3 −0 tests/fixtures/parser/ast/ts-$$slots02-no-slot-type-output.svelte
  40. +5 −0 tests/fixtures/parser/ast/ts-$$slots03-named-input.svelte
  41. +8 −0 tests/fixtures/parser/ast/ts-$$slots03-named-no-unused-expressions-result.json
  42. +804 −0 tests/fixtures/parser/ast/ts-$$slots03-named-output.json
  43. +8,686 −0 tests/fixtures/parser/ast/ts-$$slots03-named-scope-output.json
  44. +5 −0 tests/fixtures/parser/ast/ts-$$slots03-named-type-output.svelte
  45. +6 −0 tests/fixtures/parser/ast/ts-$$slots04-named-input.svelte
  46. +8 −0 tests/fixtures/parser/ast/ts-$$slots04-named-no-unused-expressions-result.json
  47. +1,186 −0 tests/fixtures/parser/ast/ts-$$slots04-named-output.json
  48. +8,686 −0 tests/fixtures/parser/ast/ts-$$slots04-named-scope-output.json
  49. +6 −0 tests/fixtures/parser/ast/ts-$$slots04-named-type-output.svelte
  50. +14 −0 tests/fixtures/parser/ast/ts-scope-issue01-input.svelte
  51. +8 −0 tests/fixtures/parser/ast/ts-scope-issue01-no-undef-result.json
  52. +14 −0 tests/fixtures/parser/ast/ts-scope-issue01-no-unused-vars-result.json
  53. +2,371 −0 tests/fixtures/parser/ast/ts-scope-issue01-output.json
  54. +9,942 −0 tests/fixtures/parser/ast/ts-scope-issue01-scope-output.json
  55. +3 −1 tests/src/parser/typescript/index.ts
  56. +12 −0 tools/update-fixtures.ts
  57. +1 −1 tools/update-meta.ts
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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 }],
},
},
{
11 changes: 6 additions & 5 deletions .github/workflows/GHPages.yml
Original file line number Diff line number Diff line change
@@ -25,15 +25,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- 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
38 changes: 22 additions & 16 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
@@ -11,77 +11,82 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- 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:
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
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Packages
run: yarn install --ignore-engines
run: pnpm install
- name: Test
run: yarn test
run: pnpm run test
test-for-ts-eslint-v4:
runs-on: ubuntu-latest
strategy:
matrix:
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: |+
yarn 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: yarn install --ignore-engines
run: pnpm install
- name: Test
run: yarn test
run: pnpm run test
test-for-eslint-v7:
runs-on: ubuntu-latest
strategy:
matrix:
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: |+
yarn add -D eslint@7 --ignore-engines
pnpm install -D eslint@7
rm -rf node_modules
- name: Install Packages
run: yarn install --ignore-engines
run: pnpm install
- name: Test
run: yarn 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: yarn install --ignore-engines
run: pnpm install
- name: Update fixtures
run: yarn update-fixtures
run: pnpm run update-fixtures
- name: Check changes
run: |
git add --all && \
@@ -90,11 +95,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Install Packages
run: yarn install --ignore-engines
run: pnpm install
- name: Test
run: yarn cover
run: pnpm run cover
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.1.2
with:
9 changes: 6 additions & 3 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -21,22 +21,25 @@ 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:
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:
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ dist
.tern-port

# repo
yarn.lock
/pnpm-lock.yaml
/lib
/.nyc_output
/coverage
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock=false
package-lock=false
enable-pre-post-scripts=true
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# svelte-eslint-parser

## 0.29.0

### Minor Changes

- [#338](https://github.com/sveltejs/svelte-eslint-parser/pull/338) [`af55230`](https://github.com/sveltejs/svelte-eslint-parser/commit/af5523076d72e29d9f7cc2708d514564a2fafb45) Thanks [@ota-meshi](https://github.com/ota-meshi)! - feat: improve $ vars type

- [#334](https://github.com/sveltejs/svelte-eslint-parser/pull/334) [`fa4adf6`](https://github.com/sveltejs/svelte-eslint-parser/commit/fa4adf6038810573df6cdead34800fb41b3ab3d5) Thanks [@baseballyama](https://github.com/baseballyama)! - **BREAKING CHANGE**: Drop Node 12 support

### Patch Changes

- [#337](https://github.com/sveltejs/svelte-eslint-parser/pull/337) [`21c0dc6`](https://github.com/sveltejs/svelte-eslint-parser/commit/21c0dc6a0b4a5e864e0181dfbb31f4b47edcefd1) Thanks [@ota-meshi](https://github.com/ota-meshi)! - fix: wrong scope for ts in `bind:`

## 0.28.0

### Minor Changes
3 changes: 2 additions & 1 deletion explorer-v2/.prettierrc
Original file line number Diff line number Diff line change
@@ -2,5 +2,6 @@
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"]
}
3 changes: 2 additions & 1 deletion explorer-v2/build-system/pre-build/webpack.config.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@ const output = {
filename: '[name].js',
library: {
type: 'module'
}
},
hashFunction: 'xxhash64'
};
const alias = {
assert: resolve('./shim-assert.cjs'),
7 changes: 5 additions & 2 deletions explorer-v2/package.json
Original file line number Diff line number Diff line change
@@ -17,18 +17,21 @@
"eslint": "^8.0.0",
"eslint-plugin-svelte3": "^4.0.0",
"eslint-scope": "^7.0.0",
"esquery": "^1.5.0",
"pako": "^2.0.3",
"svelte": "^3.41.0",
"svelte-eslint-parser": "link:.."
"svelte-eslint-parser": "link:..",
"tslib": "^2.5.0"
},
"devDependencies": {
"@sveltejs/adapter-static": "^2.0.0",
"@sveltejs/kit": "^1.0.0-next.456",
"prettier": "^2.3.0",
"prettier-plugin-svelte": "^2.3.0",
"string-replace-loader": "^3.0.1",
"typescript": "^5.0.4",
"vite": "^4.0.0",
"webpack": "^5.37.1",
"webpack": "^5.82.1",
"webpack-cli": "^5.0.0",
"wrapper-webpack-plugin": "^2.1.0"
}
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-eslint-parser",
"version": "0.28.0",
"version": "0.29.0",
"description": "Svelte parser for ESLint",
"repository": "git+https://github.com/sveltejs/svelte-eslint-parser.git",
"homepage": "https://github.com/sveltejs/svelte-eslint-parser#readme",
@@ -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,24 @@
"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",
"eslint-playground": "eslint tests/fixtures --ext .svelte --config .eslintrc-for-playground.js --format codeframe",
"cover": "nyc --reporter=lcov pnpm run test",
"debug": "pnpm run mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
"eslint-fix": "pnpm run lint --fix",
"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"
@@ -61,46 +60,48 @@
"devDependencies": {
"@changesets/changelog-github": "^0.4.6",
"@changesets/cli": "^2.24.2",
"@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.0",
"@types/eslint-visitor-keys": "^1.0.0",
"@types/estree": "^1.0.0",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.0",
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "~5.59.0",
"@typescript-eslint/types": "^5.59.5",
"benchmark": "^2.1.4",
"chai": "^4.3.4",
"env-cmd": "^10.1.0",
"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-regexp": "^1.5.0",
"eslint-plugin-svelte": "^2.0.0",
"eslint-plugin-svelte": "^2.28.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",
"magic-string": "^0.30.0",
"mocha": "^10.0.0",
"mocha-chai-jest-snapshot": "^1.1.3",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"prettier": "^2.8.0",
"prettier-plugin-pkg": "^0.17.0",
"prettier-plugin-svelte": "^2.5.0",
"prettier-plugin-svelte": "^2.10.0",
"rimraf": "^5.0.0",
"semver": "^7.3.5",
"string-replace-loader": "^3.0.3",
"svelte": "^3.57.0",
"svelte2tsx": "^0.6.11",
"typescript": "~5.0.0",
6 changes: 6 additions & 0 deletions src/context/index.ts
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import type {
Locations,
Position,
SvelteElement,
SvelteHTMLElement,
SvelteName,
SvelteScriptElement,
SvelteStyleElement,
@@ -116,6 +117,7 @@ export class Context {

public readonly parserOptions: any;

// ----- Source Code ------
public readonly sourceCode: ContextSourceCode;

public readonly tokens: Token[] = [];
@@ -126,10 +128,14 @@ export class Context {

private readonly locsMap = new Map<number, Position>();

// ----- Context Data ------
public readonly scriptLet: ScriptLetContext;

public readonly letDirCollections = new LetDirectiveCollections();

public readonly slots = new Set<SvelteHTMLElement>();

// ----- States ------
private readonly state: { isTypeScript?: boolean } = {};

private readonly blocks: Block[] = [];
Loading