Skip to content

Commit

Permalink
feat: use @eslint-community packages (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Mar 23, 2023
1 parent 41c1d7d commit c171d9c
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-flies-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-svelte": minor
---

feat: use `@eslint-community` packages
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
!/.*.js
/docs-svelte-kit/src/routes/*.md
/docs-svelte-kit/src/routes/**/*.md

# JSONSchema bug?
/.devcontainer/devcontainer.json
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ module.exports = {
usePrettierrc: true,
},
],
// Repo rule
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["/regexpp", "/regexpp/*"],
message: "Please use `@eslint-community/regexpp` instead.",
},
{
group: ["/eslint-utils", "/eslint-utils/*"],
message: "Please use `@eslint-community/eslint-utils` instead.",
},
],
},
],
},
overrides: [
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
}
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@jridgewell/sourcemap-codec": "^1.4.14",
"debug": "^4.3.1",
"eslint-utils": "^3.0.0",
"esutils": "^2.0.3",
"known-css-properties": "^0.27.0",
"postcss": "^8.4.5",
Expand Down
8 changes: 5 additions & 3 deletions src/rules/indent-helpers/commons.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { ASTNode, SourceCode } from "../../types"
import type { AST } from "svelte-eslint-parser"
import { isOpeningParenToken, isClosingParenToken } from "eslint-utils"
import {
isOpeningParenToken,
isClosingParenToken,
} from "@eslint-community/eslint-utils"
import { isNotWhitespace, isWhitespace } from "./ast"
import type { OffsetContext } from "./offset-context"

Expand Down Expand Up @@ -97,8 +100,7 @@ export function isBeginningOfElement(node: AST.SvelteText): boolean {
if (node.parent.type === "Program") {
return node.parent.body[0] === node
}
assertNever(node.parent)
return false
return assertNever(node.parent)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/rules/indent-helpers/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
isOpeningBracketToken,
isOpeningParenToken,
isSemicolonToken,
} from "eslint-utils"
} from "@eslint-community/eslint-utils"
import type { ESNodeListener } from "../../types-for-node"
import { getParent } from "../../utils/ast-utils"

Expand Down
2 changes: 1 addition & 1 deletion src/rules/indent-helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as SV from "./svelte"
import * as ES from "./es"
import * as TS from "./ts"
import { isNotWhitespace } from "./ast"
import { isCommentToken } from "eslint-utils"
import { isCommentToken } from "@eslint-community/eslint-utils"
import type { AnyToken, IndentOptions } from "./commons"
import type { OffsetCalculator } from "./offset-context"
import { OffsetContext } from "./offset-context"
Expand Down
2 changes: 1 addition & 1 deletion src/rules/indent-helpers/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
isOpeningBracketToken,
isOpeningParenToken,
isSemicolonToken,
} from "eslint-utils"
} from "@eslint-community/eslint-utils"
import type { AnyToken, IndentContext } from "./commons"
import { isBeginningOfLine } from "./commons"
import { getFirstAndLastTokens } from "./commons"
Expand Down
2 changes: 1 addition & 1 deletion src/rules/infinite-reactive-loop.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TSESTree } from "@typescript-eslint/types"
import type { AST } from "svelte-eslint-parser"
import { ReferenceTracker } from "eslint-utils"
import { ReferenceTracker } from "@eslint-community/eslint-utils"
import { createRule } from "../utils"
import type { RuleContext } from "../types"
import { findVariable } from "../utils/ast-utils"
Expand Down
5 changes: 4 additions & 1 deletion src/rules/mustache-spacing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { AST } from "svelte-eslint-parser"
import { isClosingBraceToken, isOpeningBraceToken } from "eslint-utils"
import {
isClosingBraceToken,
isOpeningBraceToken,
} from "@eslint-community/eslint-utils"
import { createRule } from "../utils"
import { getMustacheTokens } from "../utils/ast-utils"
type DeepPartial<T> = {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-dom-manipulating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { TSESTree } from "@typescript-eslint/types"
import { createRule } from "../utils"
import { findVariable, getNodeName } from "../utils/ast-utils"
import type { Variable } from "@typescript-eslint/scope-manager"
import { getPropertyName } from "eslint-utils"
import { getPropertyName } from "@eslint-community/eslint-utils"

const DOM_MANIPULATING_METHODS = new Set([
"appendChild", // https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-destructured-store-props.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TSESTree } from "@typescript-eslint/types"
import { getPropertyName } from "eslint-utils"
import { getPropertyName } from "@eslint-community/eslint-utils"
import type { AST } from "svelte-eslint-parser"
import { keyword } from "esutils"
import type { SuggestionReportDescriptor } from "../types"
Expand Down
2 changes: 1 addition & 1 deletion src/rules/reference-helpers/svelte-store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TSESTree } from "@typescript-eslint/types"
import type { Variable } from "@typescript-eslint/scope-manager"
import { ReferenceTracker } from "eslint-utils"
import { ReferenceTracker } from "@eslint-community/eslint-utils"
import type { RuleContext } from "../../types"
import type { TS, TSTools } from "../../utils/ts-utils"
import { getTypeScriptTools } from "../../utils/ts-utils"
Expand Down
2 changes: 1 addition & 1 deletion src/rules/require-event-dispatcher-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReferenceTracker } from "eslint-utils"
import { ReferenceTracker } from "@eslint-community/eslint-utils"
import { createRule } from "../utils"
import { getLangValue } from "../utils/ast-utils"
import type { TSESTree } from "@typescript-eslint/types"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isOpeningParenToken } from "eslint-utils"
import { isOpeningParenToken } from "@eslint-community/eslint-utils"
import type { AST } from "svelte-eslint-parser"
import type { RuleContext } from "../../types"
import type { ASTNodeWithParent } from "../../types-for-node"
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ASTNode, RuleContext, SourceCode } from "../types"
import type { TSESTree } from "@typescript-eslint/types"
import type { Scope, Variable } from "@typescript-eslint/scope-manager"
import type { AST as SvAST } from "svelte-eslint-parser"
import * as eslintUtils from "eslint-utils"
import * as eslintUtils from "@eslint-community/eslint-utils"
import voidElements from "./void-elements"

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type {
ESM,
READ,
TraceMap,
} from "eslint-utils/referenceTracker"
} from "@eslint-community/eslint-utils/referenceTracker"
export {
ReferenceTracker,
TrackedReferences,
} from "../../node_modules/@types/eslint-utils"
} from "../../../node_modules/@types/eslint-utils"
type Token = { type: string; value: string }
export function isArrowToken(token: Token): boolean
export function isCommaToken(token: Token): boolean
Expand Down

0 comments on commit c171d9c

Please sign in to comment.