Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .github/linters/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// super-linter resolves JAVASCRIPT_ES_CONFIG_FILE under LINTER_RULES_PATH
// (.github/linters), so this re-exports the repo's config. That keeps one
// source of truth for `npm run lint` and for super-linter's JAVASCRIPT_ES,
// JSON and JSONC linters, which all share this config.
export { default } from '../../eslint.config.mjs'
8 changes: 0 additions & 8 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ jobs:
STRIP_DEFAULT_WORKSPACE_FOR_REGEX: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: true
# ci.yml already runs `npm run lint`, which is this repo's eslint and
# this repo's eslint.config.mjs. super-linter cannot be pointed at that
# config instead: JAVASCRIPT_ES_CONFIG_FILE is shared with the JSON,
# JSONC and VUE linters, and our config has no JSON language support,
# so reusing it would silently stop linting JSON. Rather than lint JS
# twice under two different rule sets, defer to ci.yml and let
# super-linter keep its own config for JSON/JSONC.
VALIDATE_JAVASCRIPT_ES: false
VALIDATE_JSCPD: false
VALIDATE_HTML: false
# Biome is a competing formatter/linter: it wants semicolons and
Expand Down
44 changes: 41 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
// See: https://eslint.org/docs/latest/use/configure/configuration-files

import js from '@eslint/js'
import json from '@eslint/json'
import jest from 'eslint-plugin-jest'
import prettierRecommended from 'eslint-plugin-prettier/recommended'
import globals from 'globals'

// super-linter lints JavaScript and JSON with a single eslint config, so this
// file covers both. None of the shared JavaScript configs below declare `files`
// of their own, which would apply their rules to the JSON files too, so they
// are scoped explicitly.
const jsFiles = ['**/*.js', '**/*.mjs', '**/*.cjs']

export default [
{
ignores: ['**/coverage', '**/dist', '**/linter', '**/node_modules']
},
js.configs.recommended,
jest.configs['flat/recommended'],
prettierRecommended,

...[
js.configs.recommended,
jest.configs['flat/recommended'],
prettierRecommended
].map((config) => ({ ...config, files: jsFiles })),

{
files: jsFiles,

languageOptions: {
globals: {
...globals.node,
Expand All @@ -32,5 +45,30 @@ export default [
'no-unused-vars': 'off',
'prettier/prettier': 'error'
}
},

{
...json.configs.recommended,
files: ['**/*.json'],
language: 'json/json'
},

{
// super-linter routes .jsonc through this config too, so cover it here
// rather than leaving it silently unlinted if a file is ever added.
...json.configs.recommended,
files: ['**/*.jsonc'],
language: 'json/jsonc'
},

{
// npm generates the lockfile, and its `packages` map uses "" as the key for
// the root project. Turn off just that rule rather than skipping the file,
// so the remaining JSON checks still apply.
files: ['package-lock.json'],
language: 'json/json',
rules: {
'json/no-empty-keys': 'off'
}
}
]
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@eslint/json": "^2.1.0",
"@jest/globals": "^30.4.1",
"@rollup/plugin-commonjs": "^29.0.3",
"@rollup/plugin-json": "^6.1.0",
Expand Down