Skip to content

Commit c171d9c

Browse files
authored
feat: use @eslint-community packages (#403)
1 parent 41c1d7d commit c171d9c

17 files changed

+46
-17
lines changed

.changeset/soft-flies-battle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-svelte": minor
3+
---
4+
5+
feat: use `@eslint-community` packages

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@
2121
!/.*.js
2222
/docs-svelte-kit/src/routes/*.md
2323
/docs-svelte-kit/src/routes/**/*.md
24+
25+
# JSONSchema bug?
26+
/.devcontainer/devcontainer.json

.eslintrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ module.exports = {
3333
usePrettierrc: true,
3434
},
3535
],
36+
// Repo rule
37+
"no-restricted-imports": [
38+
"error",
39+
{
40+
patterns: [
41+
{
42+
group: ["/regexpp", "/regexpp/*"],
43+
message: "Please use `@eslint-community/regexpp` instead.",
44+
},
45+
{
46+
group: ["/eslint-utils", "/eslint-utils/*"],
47+
message: "Please use `@eslint-community/eslint-utils` instead.",
48+
},
49+
],
50+
},
51+
],
3652
},
3753
overrides: [
3854
{

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
}
6666
},
6767
"dependencies": {
68+
"@eslint-community/eslint-utils": "^4.2.0",
6869
"@jridgewell/sourcemap-codec": "^1.4.14",
6970
"debug": "^4.3.1",
70-
"eslint-utils": "^3.0.0",
7171
"esutils": "^2.0.3",
7272
"known-css-properties": "^0.27.0",
7373
"postcss": "^8.4.5",

src/rules/indent-helpers/commons.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { ASTNode, SourceCode } from "../../types"
22
import type { AST } from "svelte-eslint-parser"
3-
import { isOpeningParenToken, isClosingParenToken } from "eslint-utils"
3+
import {
4+
isOpeningParenToken,
5+
isClosingParenToken,
6+
} from "@eslint-community/eslint-utils"
47
import { isNotWhitespace, isWhitespace } from "./ast"
58
import type { OffsetContext } from "./offset-context"
69

@@ -97,8 +100,7 @@ export function isBeginningOfElement(node: AST.SvelteText): boolean {
97100
if (node.parent.type === "Program") {
98101
return node.parent.body[0] === node
99102
}
100-
assertNever(node.parent)
101-
return false
103+
return assertNever(node.parent)
102104
}
103105

104106
/**

src/rules/indent-helpers/es.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
isOpeningBracketToken,
1515
isOpeningParenToken,
1616
isSemicolonToken,
17-
} from "eslint-utils"
17+
} from "@eslint-community/eslint-utils"
1818
import type { ESNodeListener } from "../../types-for-node"
1919
import { getParent } from "../../utils/ast-utils"
2020

src/rules/indent-helpers/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as SV from "./svelte"
55
import * as ES from "./es"
66
import * as TS from "./ts"
77
import { isNotWhitespace } from "./ast"
8-
import { isCommentToken } from "eslint-utils"
8+
import { isCommentToken } from "@eslint-community/eslint-utils"
99
import type { AnyToken, IndentOptions } from "./commons"
1010
import type { OffsetCalculator } from "./offset-context"
1111
import { OffsetContext } from "./offset-context"

src/rules/indent-helpers/ts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
isOpeningBracketToken,
1010
isOpeningParenToken,
1111
isSemicolonToken,
12-
} from "eslint-utils"
12+
} from "@eslint-community/eslint-utils"
1313
import type { AnyToken, IndentContext } from "./commons"
1414
import { isBeginningOfLine } from "./commons"
1515
import { getFirstAndLastTokens } from "./commons"

src/rules/infinite-reactive-loop.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { TSESTree } from "@typescript-eslint/types"
22
import type { AST } from "svelte-eslint-parser"
3-
import { ReferenceTracker } from "eslint-utils"
3+
import { ReferenceTracker } from "@eslint-community/eslint-utils"
44
import { createRule } from "../utils"
55
import type { RuleContext } from "../types"
66
import { findVariable } from "../utils/ast-utils"

src/rules/mustache-spacing.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import type { AST } from "svelte-eslint-parser"
2-
import { isClosingBraceToken, isOpeningBraceToken } from "eslint-utils"
2+
import {
3+
isClosingBraceToken,
4+
isOpeningBraceToken,
5+
} from "@eslint-community/eslint-utils"
36
import { createRule } from "../utils"
47
import { getMustacheTokens } from "../utils/ast-utils"
58
type DeepPartial<T> = {

src/rules/no-dom-manipulating.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { TSESTree } from "@typescript-eslint/types"
33
import { createRule } from "../utils"
44
import { findVariable, getNodeName } from "../utils/ast-utils"
55
import type { Variable } from "@typescript-eslint/scope-manager"
6-
import { getPropertyName } from "eslint-utils"
6+
import { getPropertyName } from "@eslint-community/eslint-utils"
77

88
const DOM_MANIPULATING_METHODS = new Set([
99
"appendChild", // https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild

src/rules/prefer-destructured-store-props.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { TSESTree } from "@typescript-eslint/types"
2-
import { getPropertyName } from "eslint-utils"
2+
import { getPropertyName } from "@eslint-community/eslint-utils"
33
import type { AST } from "svelte-eslint-parser"
44
import { keyword } from "esutils"
55
import type { SuggestionReportDescriptor } from "../types"

src/rules/reference-helpers/svelte-store.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { TSESTree } from "@typescript-eslint/types"
22
import type { Variable } from "@typescript-eslint/scope-manager"
3-
import { ReferenceTracker } from "eslint-utils"
3+
import { ReferenceTracker } from "@eslint-community/eslint-utils"
44
import type { RuleContext } from "../../types"
55
import type { TS, TSTools } from "../../utils/ts-utils"
66
import { getTypeScriptTools } from "../../utils/ts-utils"

src/rules/require-event-dispatcher-types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReferenceTracker } from "eslint-utils"
1+
import { ReferenceTracker } from "@eslint-community/eslint-utils"
22
import { createRule } from "../utils"
33
import { getLangValue } from "../utils/ast-utils"
44
import type { TSESTree } from "@typescript-eslint/types"

src/shared/svelte-compile-warns/extract-leading-comments.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isOpeningParenToken } from "eslint-utils"
1+
import { isOpeningParenToken } from "@eslint-community/eslint-utils"
22
import type { AST } from "svelte-eslint-parser"
33
import type { RuleContext } from "../../types"
44
import type { ASTNodeWithParent } from "../../types-for-node"

src/utils/ast-utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ASTNode, RuleContext, SourceCode } from "../types"
22
import type { TSESTree } from "@typescript-eslint/types"
33
import type { Scope, Variable } from "@typescript-eslint/scope-manager"
44
import type { AST as SvAST } from "svelte-eslint-parser"
5-
import * as eslintUtils from "eslint-utils"
5+
import * as eslintUtils from "@eslint-community/eslint-utils"
66
import voidElements from "./void-elements"
77

88
/**

typings/eslint-utils/index.d.ts renamed to typings/@eslint-community/eslint-utils/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import type {
77
ESM,
88
READ,
99
TraceMap,
10-
} from "eslint-utils/referenceTracker"
10+
} from "@eslint-community/eslint-utils/referenceTracker"
1111
export {
1212
ReferenceTracker,
1313
TrackedReferences,
14-
} from "../../node_modules/@types/eslint-utils"
14+
} from "../../../node_modules/@types/eslint-utils"
1515
type Token = { type: string; value: string }
1616
export function isArrowToken(token: Token): boolean
1717
export function isCommaToken(token: Token): boolean

0 commit comments

Comments
 (0)