Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
50 changes: 26 additions & 24 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { defineConfig } from 'eslint/config';
import js from '@eslint/js';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import prettier from 'eslint-config-prettier/flat';
import markdown from 'eslint-plugin-markdown';
import pluginN from 'eslint-plugin-n';
import markdown from '@eslint/markdown';
import n from 'eslint-plugin-n';
import tseslint from 'typescript-eslint';

import unicorn from 'eslint-plugin-unicorn';
import eslintComments from '@eslint-community/eslint-plugin-eslint-comments/configs';
import eslintPlugin from './lib/index.ts';

const dirname = path.dirname(fileURLToPath(import.meta.url));
Expand All @@ -15,7 +17,7 @@ const compat = new FlatCompat({
recommendedConfig: js.configs.recommended,
});

export default tseslint.config([
export default defineConfig([
// Global ignores
{
ignores: [
Expand All @@ -26,19 +28,24 @@ export default tseslint.config([
'e2e/fixtures',
],
},
// Global settings
...compat.extends('not-an-aardvark/node'),

// base config
{
files: ['**/*.{js,ts}'],
languageOptions: { parser: tseslint.parser, sourceType: 'module' },
},
...compat.extends(
'not-an-aardvark/node',
'plugin:@eslint-community/eslint-comments/recommended',
'plugin:unicorn/recommended',
),
pluginN.configs['flat/recommended'],
prettier,
{
plugins: { js, n, 'eslint-plugin': eslintPlugin },
extends: [
prettier,
'js/recommended',
tseslint.configs.recommended,
'n/recommended',
Comment on lines +38 to +42
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

tseslint.configs.recommended is a config array (it was previously iterated over in this file). Passing it as a single element inside extends creates a nested array, which can lead to ESLint ignoring the config or erroring when loading the flat config. Consider expanding it into individual configs (e.g., spreading into the top-level config list, or otherwise ensuring each entry is applied as a flat config object).

Copilot uses AI. Check for mistakes.
unicorn.configs.recommended,
eslintComments.recommended,
],
rules: {
'n/no-missing-import': 'off',

'@eslint-community/eslint-comments/no-unused-disable': 'error',
'@eslint-community/eslint-comments/require-description': 'error',

Expand All @@ -52,18 +59,13 @@ export default tseslint.config([
'unicorn/no-nested-ternary': 'off',
},
},
// TypeScript rules
tseslint.configs.recommended.map((config) => ({
files: ['**/*.ts', '**/*.mts', '**/*.cts'],
...config,
rules: { ...config.rules, 'n/no-missing-import': 'off' },
})),

{
// Apply eslint-plugin rules to our own rules/tests (but not docs).
files: ['lib/**/*.ts', 'tests/**/*.ts'],
plugins: { 'eslint-plugin': eslintPlugin },
extends: ['eslint-plugin/all'],
rules: {
...eslintPlugin.configs.all.rules,
'eslint-plugin/no-meta-schema-default': 'off', // TODO: enable once https://github.com/bmish/eslint-doc-generator/issues/513 is fixed and released
'eslint-plugin/report-message-format': ['error', '^[^a-z].*.$'],
'eslint-plugin/require-meta-docs-url': [
Expand All @@ -86,11 +88,11 @@ export default tseslint.config([
plugins: { markdown },
linterOptions: { noInlineConfig: true },
rules: {
strict: 'off',
'no-undef': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',

strict: 'off',
'@typescript-eslint/no-require-imports': 'off',

'@eslint-community/eslint-comments/require-description': 'off',

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/meta-property-ordering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const rule: Rule.RuleModule = {

const knownProps = props
.filter((prop) => orderMap.has(getKeyName(prop)))
.sort(
.toSorted(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's reported by the new eslint-plugin-unicorn.

(a, b) =>
orderMap.get(getKeyName(a))! - orderMap.get(getKeyName(b))!,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-identical-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const rule: Rule.RuleModule = {
}
return JSON.stringify([
test.type,
...test.properties.map((p) => sourceCode.getText(p)).sort(),
...test.properties.map((p) => sourceCode.getText(p)).toSorted(),
]);
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
"@commitlint/cli": "^20.0.0",
"@commitlint/config-conventional": "^20.0.0",
"@commitlint/types": "^20.0.0",
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^9.39.2",
"@eslint/markdown": "^7.5.1",
"@types/eslint-plugin-markdown": "^2.0.2",
"@types/eslint-scope": "^8.4.0",
"@types/espree": "^10.1.0",
Expand All @@ -69,9 +70,8 @@
"eslint-config-not-an-aardvark": "^2.1.0",
"eslint-config-prettier": "^10.1.8",
"eslint-doc-generator": "^2.2.2",
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-n": "^17.21.0",
"eslint-plugin-unicorn": "^56.0.1",
"eslint-plugin-unicorn": "^62.0.0",
"eslint-remote-tester": "^4.0.3",
"eslint-scope": "^8.4.0",
"espree": "^11.1.0",
Expand Down
Loading