Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,62 @@ extends:
- plugin:@eslint-community/mysticatea/es2015
- plugin:@eslint-community/mysticatea/+eslint-plugin

rules:
"@eslint-community/mysticatea/node/file-extension-in-import":
- error
- always
- ".ts": "always"
"@eslint-community/mysticatea/ts/naming-convention":
- off
"@eslint-community/mysticatea/ts/prefer-readonly-parameter-types":
- off
"@eslint-community/mysticatea/ts/no-unsafe-member-access":
- off
"@eslint-community/mysticatea/ts/no-var-requires":
- off
"@eslint-community/mysticatea/ts/no-require-imports":
- off
"@eslint-community/mysticatea/ts/no-unsafe-assignment":
- off
"@eslint-community/mysticatea/ts/no-unsafe-call":
- off
"@eslint-community/mysticatea/ts/no-unsafe-argument":
- off
"@eslint-community/mysticatea/ts/no-unsafe-return":
- off
"@eslint-community/mysticatea/ts/ban-ts-comment":
- off
"@eslint-community/mysticatea/ts/no-non-null-asserted-optional-chain":
- off
"@eslint-community/mysticatea/ts/prefer-optional-chain":
- off
"@eslint-community/mysticatea/ts/prefer-nullish-coalescing":
- off
"@eslint-community/mysticatea/ts/no-floating-promises":
- off
"@eslint-community/mysticatea/ts/no-unnecessary-type-assertion":
- off
"no-shadow":
- off
"@eslint-community/mysticatea/node/no-missing-import": off
"@eslint-community/mysticatea/node/no-unpublished-import": off

overrides:
- files: "docs/.vuepress/components/*.vue"
parserOptions:
parser: "@babel/eslint-parser"

- files: "lib/rules/*.js"
- files: "lib/rules/*.ts"
rules:
"@eslint-community/mysticatea/eslint-plugin/require-meta-docs-url":
- error
- pattern: "https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/{{name}}.html"

- files: ["lib/configs.js", "lib/rules.js", "lib/utils.js"]
- files: ["lib/configs.ts", "lib/rules.ts", "lib/utils.ts"]
rules:
"@eslint-community/mysticatea/node/global-require": off

- files: ["tests/**/*.js", "scripts/**/*.js"]
- files: ["tests/**/*.ts", "scripts/**/*.ts"]
rules:
"@eslint-community/mysticatea/node/global-require": off
"@eslint-community/mysticatea/node/no-sync": off
92 changes: 80 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: ⎔ Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22

- name: 📥 Install dependencies
run: npm install
Expand All @@ -43,33 +43,32 @@ jobs:
run: npm run lint

test:
name:
🧪 Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{
name: 🧪 Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{
matrix.os }})
strategy:
fail-fast: false
matrix:
eslint: [8]
node: [12.22.0, 12, 14.17.0, 14, 16.0.0, 16, 18.0.0, 18, 20, 22, 24]
node: [22, 24]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing these entries from the CI matrix, when the engines list haven't been reduced is creating a blind spot. Is there a reason these versions were dropped?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual build process as well as the unit-tests need --experimental-transform-types and/or --experimental-strip-types which are not available on the older versions of Node.js. Also building, testing and type checking on that many versions of Node might be a bit excessive. We could use this oppurtunity to update the engines field as well but if we really want to go that far back in Node versions then I think I might have to switch things around and maybe switch to a vitest or some other testing framework.

Copy link

@michaelfaith michaelfaith Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would support updating engines, but just calling out that if engines don't change, and these are dropped from the matrix, then we'd no longer be testing the full range of node versions that we claim to support. I don't think that matrix array is excessive given the engines declaration. it's the first and last node version for each major in the engines range. (except for 20, 22, and 24 for some reason 🤔 )

os: [ubuntu-latest]
include:
# On other platforms
- os: windows-latest
eslint: 8
node: 18
node: 22
- os: macos-latest
eslint: 8
node: 18
node: 22
# On ESLint 9
- eslint: 9
node: 18
node: 22
os: ubuntu-latest
# On old ESLint versions
- eslint: 7
node: 18
node: 22
os: ubuntu-latest
- eslint: 6
node: 18
node: 22
os: ubuntu-latest
# On the minimum supported ESLint/Node.js version
- eslint: 6.0.0
Expand All @@ -84,25 +83,94 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true

- name: 📥 Install dependencies
run: npm install --legacy-peer-deps

- name: 📥 Build
run: npm run build

- name: 📥 Install ESLint v${{ matrix.eslint }}
run: npm install --save-dev eslint@${{ matrix.eslint }}

- name: ▶️ Run test script
env:
NODE_OPTIONS: --experimental-transform-types
run: npm run test

- name: ⬆️ Upload coverage report
uses: codecov/codecov-action@v4

are-the-types-wrong:
name: 🤔 Are the types wrong?
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: ⎔ Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: 📥 Install dependencies
run: npm install --legacy-peer-deps

- name: ▶️ Run check-exports script
run: npm run check-exports

- name: ▶️ Run typecheck script
run: npm run typecheck

type-tests:
name: 🧪 Type tests with ESLint ${{ matrix.eslint }} and TypeScript ${{ matrix.ts }}
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
eslint: [8, 9]
ts: ["5.7", "5.8", "5.9"]

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: ⎔ Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: 📥 Install dependencies
run: npm install

- name: Pack the package
id: pack
run: npm install "$(npm pack | tail -n1)"

- name: 📥 Uninstall @types/eslint
if: matrix.eslint != 8
run: npm uninstall @types/eslint

- name: 📥 Install ESLint version ${{ matrix.eslint }}
run: npm install --save-dev eslint@${{ matrix.eslint }}

- name: 📥 Install TypeScript version ${{ matrix.ts }}
run: npm install --save-dev typescript@${{ matrix.ts }} -f

- name: ▶️ Run typecheck script
run: npm run typecheck

- name: 📝 List version of ESLint
run: npm why eslint @types/eslint

release:
name: 🚀 Release
needs: [ lint, test ]
needs: [lint, test]
runs-on: ubuntu-latest
if:
github.repository == 'eslint-community/eslint-plugin-eslint-comments' &&
if: github.repository == 'eslint-community/eslint-plugin-eslint-comments' &&
contains('refs/heads/main,refs/heads/next,refs/heads/beta,refs/heads/alpha',
github.ref) && github.event_name == 'push'
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
/node_modules
/npm-debug.log
/test.js
dist/
.rolldown/
22 changes: 0 additions & 22 deletions configs.js

This file was deleted.

20 changes: 20 additions & 0 deletions configs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { ESLint, Linter } from "eslint"
import { rulesRecommended } from "./lib/configs/recommended.ts"
import { rules } from "./lib/rules.ts"
import packageJson from "./package.json" with { type: "json" }

const plugin = {
meta: {
name: packageJson.name,
version: packageJson.version,
},
rules,
} as const satisfies ESLint.Plugin

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just calling out that from a type perspective as const isn't necessary here since it's using satisfies. The only added value is that it "freezes " the object also. Is that what you were going for, or would satisfies... suffice 😅


export const recommended = {
name: "@eslint-community/eslint-comments/recommended",
plugins: {
"@eslint-community/eslint-comments": plugin,
},
rules: rulesRecommended,
} as const satisfies Linter.FlatConfig
8 changes: 0 additions & 8 deletions index.js

This file was deleted.

3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * as configs from "./lib/configs.ts"
export { rules } from "./lib/rules.ts"
export * as utils from "./lib/utils.ts"
6 changes: 0 additions & 6 deletions lib/configs.js

This file was deleted.

1 change: 1 addition & 0 deletions lib/configs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as recommended from "./configs/recommended.ts"
13 changes: 0 additions & 13 deletions lib/configs/recommended.js

This file was deleted.

13 changes: 13 additions & 0 deletions lib/configs/recommended.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Linter } from "eslint"

export const plugins = [
"@eslint-community/eslint-comments",
] as const satisfies Linter.LegacyConfig["plugins"]

export const rulesRecommended = {
"@eslint-community/eslint-comments/disable-enable-pair": "error",
"@eslint-community/eslint-comments/no-aggregating-enable": "error",
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
"@eslint-community/eslint-comments/no-unused-enable": "error",
} as const satisfies Linter.Config["rules"]
Loading