Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
build: migrate eslint.config.js to typescript
This change migrates the eslint config for the repo to typescript. This is in support of the larger migration to typescript. In order for us to continue to consume the plugin locally, after it's been converted to typescript (without having to build first), we'll need to be loading the config from typescript. Since I needed to update eslint to support, I took the opportunity to all of the other plugins too (except unicorn). I also removed a rule disable that had a note on it about dropping after we dropped support for node 14.
  • Loading branch information
michaelfaith committed Jul 19, 2025
commit 3472bd88b2ed13b85d0c20463f709d47b6789d5f
7 changes: 4 additions & 3 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import { defineConfig } from 'eslint/config';
import markdown from 'eslint-plugin-markdown';
import pluginN from 'eslint-plugin-n';
// @ts-expect-error - eslint-plugin is not typed yet
import eslintPlugin from './lib/index.js';

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

export default [
export default defineConfig([
// Global ignores
{
ignores: ['node_modules', 'coverage'],
Expand All @@ -39,7 +41,6 @@ export default [
'unicorn/no-array-reduce': 'off',
'unicorn/no-null': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-node-protocol': 'off', // TODO: enable once we drop support for Node 14.17.
'unicorn/prevent-abbreviations': 'off',
},
},
Expand Down Expand Up @@ -82,4 +83,4 @@ export default [
'unicorn/filename-case': 'off',
},
},
];
]);
2 changes: 1 addition & 1 deletion lib/rules/require-meta-docs-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Requirements
// -----------------------------------------------------------------------------

import path from 'path';
import path from 'node:path';
import * as utils from '../utils.js';
import { getStaticValue } from '@eslint-community/eslint-utils';

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"@eslint/eslintrc": "^3.0.2",
"@eslint/js": "^9.31.0",
"@release-it/conventional-changelog": "^9.0.3",
"@types/eslint-plugin-markdown": "^2.0.2",
"@types/estree": "^1.0.8",
"@types/node": "^20.19.0",
"@typescript-eslint/parser": "^8.34.1",
"@typescript-eslint/utils": "^8.34.1",
"@vitest/coverage-istanbul": "^3.2.4",
Expand All @@ -66,6 +68,7 @@
"eslint-scope": "^8.0.1",
"espree": "^10.0.1",
"husky": "^9.1.7",
"jiti": "^2.4.2",
"lodash": "^4.17.21",
"markdownlint-cli": "^0.43.0",
"npm-package-json-lint": "^8.0.0",
Expand Down Expand Up @@ -97,6 +100,5 @@
"npm": {
"skipChecks": true
}
},
"packageManager": "pnpm@10.13.0+sha512.e08cbfa5d0c47e148d9d92965513af3d06a42ff99b6e0e82a7d10512858d0fb680a03c1e6772d369a2305c79306c9257989a3576b7057d6877469c9a1c7563f0"
}
}
4 changes: 2 additions & 2 deletions tests/lib/rules/no-property-in-node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RuleTester } from 'eslint';
import path from 'path';
import { fileURLToPath } from 'url';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import rule from '../../../lib/rules/no-property-in-node.js';
import parser from '@typescript-eslint/parser';

Expand Down
14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"rootDir": ".",
"declaration": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022"
}
}