Skip to content

Commit

Permalink
feat: use @eslint-community packages (#180)
Browse files Browse the repository at this point in the history
* feat: use `@eslint-community` packages

* Create .changeset/great-cats-sparkle.md

* fix
  • Loading branch information
ota-meshi authored Mar 16, 2023
1 parent 7f1f55a commit 186f9c1
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-cats-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-astro": minor
---

feat: use `@eslint-community` packages
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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 @@ -52,10 +52,10 @@
},
"homepage": "https://ota-meshi.github.io/eslint-plugin-astro/",
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@jridgewell/sourcemap-codec": "^1.4.14",
"@typescript-eslint/types": "^5.25.0",
"astro-eslint-parser": "^0.12.0",
"eslint-utils": "^3.0.0",
"postcss": "^8.4.14",
"postcss-selector-parser": "^6.0.10"
},
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-deprecated-astro-canonicalurl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { READ, ReferenceTracker } from "eslint-utils"
import { READ, ReferenceTracker } from "@eslint-community/eslint-utils"
import { createRule } from "../utils"

export default createRule("no-deprecated-astro-canonicalurl", {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-deprecated-astro-fetchcontent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { READ, ReferenceTracker } from "eslint-utils"
import { READ, ReferenceTracker } from "@eslint-community/eslint-utils"
import { createRule } from "../utils"

export default createRule("no-deprecated-astro-fetchcontent", {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-deprecated-astro-resolve.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { READ, ReferenceTracker } from "eslint-utils"
import { READ, ReferenceTracker } from "@eslint-community/eslint-utils"
import { createRule } from "../utils"

export default createRule("no-deprecated-astro-resolve", {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-unused-css-selector.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { TSESTree } from "@typescript-eslint/types"
import { AST_NODE_TYPES } from "@typescript-eslint/types"
import type { AST } from "astro-eslint-parser"
import { getStaticValue } from "eslint-utils"
import { getStaticValue } from "@eslint-community/eslint-utils"
import type { Node as PostcssNode } from "postcss"
import postcss from "postcss"
import parser from "postcss-selector-parser"
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-unused-define-vars-in-style.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { TSESTree } from "@typescript-eslint/types"
import { AST_NODE_TYPES } from "@typescript-eslint/types"
import type { AST } from "astro-eslint-parser"
import { getPropertyName } from "eslint-utils"
import { getPropertyName } from "@eslint-community/eslint-utils"
import { createRule } from "../utils"
import { getAttributeName } from "../utils/ast-utils"
import { iterateCSSVars } from "../utils/style"
Expand Down
4 changes: 2 additions & 2 deletions src/rules/prefer-object-class-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { TSESTree } from "@typescript-eslint/types"
import { AST_NODE_TYPES } from "@typescript-eslint/types"
import type { AST } from "astro-eslint-parser"
import type { Rule } from "eslint"
import { getPropertyName } from "eslint-utils"
import { isCommaToken } from "eslint-utils"
import { getPropertyName } from "@eslint-community/eslint-utils"
import { isCommaToken } from "@eslint-community/eslint-utils"
import { createRule } from "../utils"
import {
extractConcatExpressions,
Expand Down
9 changes: 6 additions & 3 deletions src/rules/prefer-split-class-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import type { AST } from "astro-eslint-parser"
import { AST_NODE_TYPES } from "@typescript-eslint/types"
import type { TSESTree } from "@typescript-eslint/types"
import { createRule } from "../utils"
import type { TrackedReferences } from "eslint-utils"
import { isOpeningParenToken, ReferenceTracker } from "eslint-utils"
import type { TrackedReferences } from "@eslint-community/eslint-utils"
import {
isOpeningParenToken,
ReferenceTracker,
} from "@eslint-community/eslint-utils"
import {
extractConcatExpressions,
getAttributeName,
Expand All @@ -13,7 +16,7 @@ import {
import type { Token } from "../utils/string-literal-parser"
import { parseStringTokens } from "../utils/string-literal-parser"
import type { Rule } from "eslint"
import { getPropertyName } from "eslint-utils"
import { getPropertyName } from "@eslint-community/eslint-utils"

export default createRule("prefer-split-class-list", {
meta: {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import type { AST } from "astro-eslint-parser"
import type { TSESTree } from "@typescript-eslint/types"
import { AST_NODE_TYPES } from "@typescript-eslint/types"
import type { RuleContext, SourceCode } from "../types"
import type { StaticValue } from "eslint-utils"
import type { StaticValue } from "@eslint-community/eslint-utils"
import {
isParenthesized,
isOpeningParenToken,
isClosingParenToken,
getStaticValue,
} from "eslint-utils"
} from "@eslint-community/eslint-utils"

/**
* Get the attribute key name from given attribute node
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export * from "../../node_modules/@types/eslint-utils"
export * from "../../../node_modules/@types/eslint-utils"
import type { AST } from "astro-eslint-parser"
import type { Scope } from "eslint"
import type * as ESTree from "estree"
import type { TSESTree } from "@typescript-eslint/types"
import type { SourceCode } from "../../src/types"
import type { SourceCode } from "../../../src/types"
type Token = { type: string; value: string }
export function isArrowToken(token: Token): boolean
export function isCommaToken(token: Token): boolean
Expand Down

0 comments on commit 186f9c1

Please sign in to comment.