Skip to content
44 changes: 28 additions & 16 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v6
- name: Install Packages
run: npm install --legacy-peer-deps
run: pnpm install
- name: Lint
run: npm run lint
run: pnpm run lint

test:
name: Test
Expand All @@ -35,46 +37,52 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js v${{ matrix.node }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
- name: Install Packages
run: npm install
run: pnpm install
- name: Test
run: npm test
run: pnpm test

test-with-eslint-v8:
name: Test with ESLint v8
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js v18
uses: actions/setup-node@v6
with:
node-version: 18
- name: Install Packages
run: npm install
run: pnpm install
- name: Install ESLint v8
run: npm install --save-dev eslint@8 --force
run: pnpm install --save-dev eslint@8 --force
- name: Test
run: npm test
run: pnpm test

test-without-eslint-stylistic:
name: Test without ESLint Stylistic
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v6
- name: Install Packages
run: npm install
run: pnpm install
- name: Uninstall @stylistic/eslint-plugin
run: npm uninstall @stylistic/eslint-plugin
run: pnpm uninstall @stylistic/eslint-plugin
- name: Test
run: npm test
run: pnpm test

test-with-old-eslint-stylistic:
name: Test with old ESLint Stylistic
Expand All @@ -85,26 +93,30 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v6
- name: Install Packages
run: npm install
run: pnpm install
- name: Install @stylistic/eslint-plugin v${{ matrix.stylistic }}
run: npm install -D @stylistic/eslint-plugin@${{ matrix.stylistic }} --force
run: pnpm install -D @stylistic/eslint-plugin@${{ matrix.stylistic }} --force
- name: Test
run: npm test
run: pnpm test

test-with-typescript-eslint-v7:
name: Test with typescript-eslint v7
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v6
- name: Install Packages
run: npm install
run: pnpm install
- name: Install @typescript-eslint/parser v7
run: npm install -D @typescript-eslint/parser@7 --force
run: pnpm install -D @typescript-eslint/parser@7 --force
- name: Test
run: npm test
run: pnpm test
8 changes: 5 additions & 3 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
- name: Install Dependencies
run: npm install
run: pnpm install

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: npm run changeset:version
publish: npm run changeset:publish
version: pnpm run changeset:version
publish: pnpm run changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions .github/workflows/check-for-resources-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 18
- name: Install Packages
run: npm install
run: pnpm install
- name: Update
run: npm run update-resources
run: pnpm run update-resources
- uses: peter-evans/create-pull-request@v7
with:
commit-message: Updates resources
Expand Down
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
/test.*
yarn.lock
yarn-error.log
/docs/.vitepress/dist
/docs/.vitepress/build-system/shim/vue-eslint-parser.mjs
/docs/.vitepress/build-system/shim/@typescript-eslint/parser.mjs
/docs/.vitepress/.temp
/docs/.vitepress/cache
typings/eslint/lib/rules
eslint-typegen.d.ts

docs/.vitepress/dist
docs/.vitepress/build-system/shim/@typescript-eslint
docs/.vitepress/build-system/shim/vue-eslint-parser.js
docs/.vitepress/.temp
docs/.vitepress/cache
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build(
dirname,
'../../../node_modules/@typescript-eslint/parser/dist/index.js'
),
path.join(dirname, './shim/@typescript-eslint/parser.mjs'),
path.join(dirname, './shim/@typescript-eslint/parser.js'),
[
'util',
'node:util',
Expand All @@ -30,7 +30,7 @@ build(

build(
path.join(dirname, '../../../node_modules/vue-eslint-parser/index.js'),
path.join(dirname, './shim/vue-eslint-parser.mjs'),
path.join(dirname, './shim/vue-eslint-parser.js'),
[
'path',
'debug',
Expand Down Expand Up @@ -60,7 +60,7 @@ function bundle(entryPoint: string, externals: string[]) {
bundle: true,
external: externals,
write: false,
inject: [path.join(dirname, './src/process-shim.mjs')]
inject: [path.join(dirname, './src/process-shim.js')]
})

return `${result.outputFiles[0].text}`
Expand Down
16 changes: 8 additions & 8 deletions docs/.vitepress/config.mts → docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import type { DefaultTheme } from 'vitepress'
import { defineConfig } from 'vitepress'
import path from 'pathe'
import { fileURLToPath } from 'url'
import { viteCommonjs, vitePluginRequireResolve } from './vite-plugin.mjs'
import { viteCommonjs, vitePluginRequireResolve } from './vite-plugin'
import eslint4b, { requireESLintUseAtYourOwnRisk4b } from 'vite-plugin-eslint4b'

// Pre-build cjs packages that cannot be bundled well.
import './build-system/build.mjs'
import './build-system/build'

const dirname = path.dirname(fileURLToPath(import.meta.url))

Expand Down Expand Up @@ -152,18 +152,18 @@ export default async () => {
alias: {
'vue-eslint-parser': path.join(
dirname,
'./build-system/shim/vue-eslint-parser.mjs'
'./build-system/shim/vue-eslint-parser.js'
),
'@typescript-eslint/parser': path.join(
dirname,
'./build-system/shim/@typescript-eslint/parser.mjs'
'./build-system/shim/@typescript-eslint/parser.js'
),

tslib: path.join(dirname, '../../node_modules/tslib/tslib.es6.js'),
globby: path.join(dirname, './build-system/shim/empty.mjs'),
'fast-glob': path.join(dirname, './build-system/shim/empty.mjs'),
tinyglobby: path.join(dirname, './build-system/shim/empty.mjs'),
module: path.join(dirname, './build-system/shim/empty.mjs')
globby: path.join(dirname, './build-system/shim/empty.js'),
'fast-glob': path.join(dirname, './build-system/shim/empty.js'),
tinyglobby: path.join(dirname, './build-system/shim/empty.js'),
module: path.join(dirname, './build-system/shim/empty.js')
}
},
define: {
Expand Down
18 changes: 6 additions & 12 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
// @ts-expect-error -- Browser
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import Layout from './Layout.vue'
import ESLintCodeBlock from './components/eslint-code-block.vue'
import RulesTable from './components/rules-table.vue'

if (typeof window !== 'undefined' && typeof require === 'undefined') {
// @ts-expect-error -- Browser
;(window as any).require = () => {
const e = new Error('require is not defined')
;(e as any).code = 'MODULE_NOT_FOUND'
throw e
}
}
// @ts-expect-error -- Cannot change `module` option
import type { Theme } from 'vitepress'
// @ts-expect-error -- Cannot change `module` option
import DefaultTheme from 'vitepress/theme'
// @ts-expect-error -- ignore
import Layout from './Layout.vue'
// @ts-expect-error -- ignore
import ESLintCodeBlock from './components/eslint-code-block.vue'
// @ts-expect-error -- ignore
import RulesTable from './components/rules-table.vue'

const theme: Theme = {
...DefaultTheme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { UserConfig } from 'vitepress'
import path from 'pathe'
import { fileURLToPath } from 'url'
import esbuild from 'esbuild'

type Plugin = Extract<
NonNullable<NonNullable<UserConfig['vite']>['plugins']>[number],
{ name: string }
Expand Down
8 changes: 8 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vitepress",
"build": "vitepress build"
}
}
14 changes: 14 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"lib": ["ESNext", "DOM"],
},
"include": [
".vitepress/**/*.js",
".vitepress/**/*.ts",
".vitepress/**/*.vue"
]
}
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
],
// turn off some rules from shared configs in all files
rules: {
'eslint-plugin/require-meta-default-options': 'off', // TODO: enable when all rules have defaultOptions

Check warning on line 82 in eslint.config.mjs

View workflow job for this annotation

GitHub Actions / Lint

Unexpected 'todo' comment: 'TODO: enable when all rules have...'
'eslint-plugin/require-meta-docs-recommended': 'off', // use `categories` instead
'eslint-plugin/require-meta-schema-description': 'off',

Expand All @@ -100,7 +100,7 @@

{
name: 'typescript/setup',
files: ['**/*.{ts,mts}'],
files: ['docs/**/*.js', '**/*.{ts,mts}'],
languageOptions: {
parser: tsEslintParser,
parserOptions: {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Official ESLint plugin for Vue.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"packageManager": "pnpm@10.23.0",
"scripts": {
"new": "node tools/new-rule.js",
"start": "npm run test:base -- --watch",
Expand All @@ -22,9 +23,9 @@
"update": "node ./tools/update.js",
"update-resources": "node ./tools/update-resources.js",
"typegen": "node ./tools/generate-typegen.mjs",
"docs:watch": "vitepress dev docs",
"docs:watch": "pnpm -C docs run dev",
"predocs:build": "npm run update",
"docs:build": "vitepress build docs",
"docs:build": "pnpm -C docs run build",
"generate:version": "env-cmd -e version npm run update && npm run lint:fix",
"changeset:version": "changeset version && npm run generate:version && git add --all",
"changeset:publish": "npm run typegen && changeset publish"
Expand Down
2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- docs
18 changes: 18 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"noEmit": true,
"strict": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true
}
}
19 changes: 2 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "ES2019",
"module": "node16",
"moduleResolution": "Node16",
"lib": ["es2020"],
"allowJs": true,
"checkJs": true,
"noEmit": true,
"strict": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"baseUrl": ".",
"paths": {
"*": ["typings/*"]
},
"skipLibCheck": true
}
},
"include": [
"lib/**/*",
"typings/eslint-plugin-vue/global.d.ts",
"docs/.vitepress/**/*.ts",
"docs/.vitepress/**/*.mts"
]
}
Loading