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
42 changes: 0 additions & 42 deletions .eslintrc.js

This file was deleted.

109 changes: 109 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import base, { createConfig } from '@metamask/eslint-config';
import jest from '@metamask/eslint-config-jest';
import nodejs from '@metamask/eslint-config-nodejs';
import typescript from '@metamask/eslint-config-typescript';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

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

const config = createConfig([
...base,
{
ignores: ['coverage/**', 'dist/**', 'docs/**', '.yarn/**'],
},
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
{
rules: {
// Handled by Oxfmt.
'prettier/prettier': 'off',
'import-x/order': 'off',
},
},
{
files: ['**/*.{js,cjs,mjs}', '**/*.test.{js,ts}', '**/tests/**/*.{js,ts}'],
extends: [nodejs],
},
{
files: ['**/*.{js,cjs}'],
languageOptions: {
sourceType: 'script',
ecmaVersion: 2020,
},
},
{
files: ['**/*.mjs'],
languageOptions: {
sourceType: 'module',
},
},
{
files: ['**/*.ts'],
extends: [typescript],
languageOptions: {
parserOptions: {
tsconfigRootDir,
},
},
},
{
files: ['**/*.test.{js,ts}', '**/tests/**/*.{js,ts}'],
extends: [jest],
},
// Project-wide rule overrides. These go after every `extends` so they win.
{
rules: {
// TODO: Re-enable these rules.
// They were not enforced under the legacy eslint-config v12, and fixing
// roughly 150 JSDoc blocks is out of scope for a config migration.
// `require-jsdoc` in particular must stay off while suppressed: its
// autofixer inserts empty `/** */` blocks and mangles surrounding code.
// Core disables it for the same reason.
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/tag-lines': 'off',
},
},
{
files: ['**/*.ts'],
rules: {
// TODO: Re-enable these rules.
// Newly surfaced by eslint-config v15; not enforced under v12.
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
},
},
{
settings: {
// `uuid` ships an exports map that the TypeScript resolver cannot read,
// so `import-x` sees no named exports and false positives on `uuid.v4`.
'import-x/ignore': ['uuid'],
},
},
{
files: ['**/*.test-d.ts'],
rules: {
// In `tsd` type tests the assertions carry the meaning of the test, so
// the autofixer actively destroys them. Stripping `as any` from
// `expectAssignable<Json>(null as any)`, for instance, deletes the very
// thing that assertion exists to prove.
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
},
},
{
files: ['**/*.test.{js,ts}'],
rules: {
// These tests deliberately reach for `crypto` and `crypto.webcrypto`,
// and polyfill the global when running on Node 18. Flagging them as
// unsupported defeats the purpose of the polyfill they are testing.
'n/no-unsupported-features/node-builtins': 'off',
},
},
]);

export default config;
32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"lint:changelog": "auto-changelog validate --prettier",
"lint:constraints": "yarn constraints",
"lint:dependencies": "depcheck && yarn dedupe",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:eslint": "eslint . --cache",
"lint:fix": "yarn lint:eslint --fix && yarn lint:constraints --fix && yarn lint:misc --write && yarn lint:dependencies && yarn lint:changelog",
"lint:misc": "oxfmt --ignore-path .gitignore",
"prepack": "./scripts/prepack.sh",
Expand All @@ -78,28 +78,28 @@
"devDependencies": {
"@lavamoat/allow-scripts": "^3.0.4",
"@lavamoat/preinstall-always-fail": "^1.0.0",
"@metamask/auto-changelog": "^3.1.0",
"@metamask/eslint-config": "^12.0.0",
"@metamask/eslint-config-jest": "^12.0.0",
"@metamask/eslint-config-nodejs": "^12.0.0",
"@metamask/eslint-config-typescript": "^12.0.0",
"@metamask/auto-changelog": "^6.1.0",
"@metamask/eslint-config": "^15.0.0",
"@metamask/eslint-config-jest": "^15.0.0",
"@metamask/eslint-config-nodejs": "^15.0.0",
"@metamask/eslint-config-typescript": "^15.0.0",
"@ts-bridge/cli": "^0.1.2",
"@ts-bridge/shims": "^0.1.1",
"@types/jest": "^28.1.7",
"@types/jest-when": "^3.5.3",
"@types/node": "~18.18.14",
"@types/semver": "^7",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"depcheck": "^1.4.7",
"eslint": "^8.44.0",
"eslint": "^9.39.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-jsdoc": "^39.9.1",
"eslint-plugin-n": "^15.7.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import-x": "^4.3.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-jsdoc": "^50.2.4",
"eslint-plugin-n": "^17.10.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-promise": "^7.1.0",
"jest": "^29.2.2",
"jest-it-up": "^2.0.2",
"jest-when": "^3.6.0",
Expand All @@ -111,6 +111,7 @@
"tsd": "^0.29.0",
"typedoc": "^0.23.15",
"typescript": "~5.3.3",
"typescript-eslint": "^8.48.0",
"web3": "^4.16.0"
},
"resolutions": {
Expand All @@ -125,7 +126,8 @@
"packageManager": "yarn@4.16.0",
"lavamoat": {
"allowScripts": {
"@lavamoat/preinstall-always-fail": false
"@lavamoat/preinstall-always-fail": false,
"eslint-plugin-import-x>unrs-resolver": false
}
}
}
Loading
Loading