Skip to content

Commit

Permalink
fix: update svelte-eslint-parser to v0.23 (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Feb 3, 2023
1 parent 37e492c commit 3464f23
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-impalas-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-svelte": minor
---

fix: update svelte-eslint-parser to v0.23
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"postcss": "^8.4.5",
"postcss-load-config": "^3.1.4",
"postcss-safe-parser": "^6.0.0",
"svelte-eslint-parser": "^0.22.0"
"svelte-eslint-parser": "^0.23.0"
},
"devDependencies": {
"@1stg/browserslist-config": "^1.2.3",
Expand Down
7 changes: 6 additions & 1 deletion src/utils/get-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import fs from "fs"
import path from "path"
import { createCache } from "./cache"

type PackageJson = Record<string, any> & { filePath: string }
type PackageJson = {
name?: unknown
dependencies?: { [key in string]?: unknown }
devDependencies?: { [key in string]?: unknown }
filePath: string
}

const isRunOnBrowser = !fs.readFileSync
const cache = createCache<PackageJson | null>()
Expand Down
4 changes: 2 additions & 2 deletions src/utils/svelte-kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function hasSvelteKit(filePath: string): boolean {
// So always it returns true if it runs on the package.
return true
return Boolean(
packageJson.dependencies["@sveltejs/kit"] ??
packageJson.devDependencies["@sveltejs/kit"],
packageJson.dependencies?.["@sveltejs/kit"] ??
packageJson.devDependencies?.["@sveltejs/kit"],
)
} catch (_e) {
return false
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/rules/sort-attributes/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
rules: {
"no-use-before-define": "off",
},
}

0 comments on commit 3464f23

Please sign in to comment.