diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 12447de..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": [ - "plugin:n/recommended", - "plugin:putout/safe+align" - ], - "plugins": [ - "n", - "putout" - ] -} diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 0fbf1bc..5391ee0 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -12,7 +12,7 @@ jobs: node-version: - 18.x - 20.x - - 21.x + - 22.x steps: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 @@ -30,7 +30,7 @@ jobs: run: redrun fix:lint - name: Install Rust run: rustup update - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ diff --git a/.madrun.js b/.madrun.js index 3c3e00d..b6a8706 100644 --- a/.madrun.js +++ b/.madrun.js @@ -1,7 +1,4 @@ -import { - run, - cutEnv, -} from 'madrun'; +import {run, cutEnv} from 'madrun'; const NODE_OPTIONS = `'--no-warnings --import ./lib/register.js'`; const testEnv = { diff --git a/.npmignore b/.npmignore index a5966ae..6ada9d7 100644 --- a/.npmignore +++ b/.npmignore @@ -9,3 +9,4 @@ coverage* example coverage +*.config.* diff --git a/.nycrc.json b/.nycrc.json index df171b2..bd520eb 100644 --- a/.nycrc.json +++ b/.nycrc.json @@ -4,7 +4,8 @@ "exclude": [ "**/*.spec.js", "**/fixture", - "**/*.*.js" + "**/*.*.js", + "**/*.config.*" ], "branches": 100, "lines": 100, diff --git a/README.md b/README.md index c16723b..8e91608 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ export {readFile as readFile1} from 'fs/promises'; ```js /* ❌ */ export * from 'fs/promises'; + // doesn't have syntax equivalent ``` @@ -170,10 +171,7 @@ You can test it with 📼[`Supertape`](https://github.com/coderaiser/supertape): ```js import {createMockImport} from 'mock-import'; -import { - test, - stub, -} from 'supertape'; +import {test, stub} from 'supertape'; const { mockImport, @@ -202,10 +200,7 @@ Now let's trace it: ```js import {createMockImport} from 'mock-import'; -import { - test, - stub, -} from 'supertape'; +import {test, stub} from 'supertape'; const { mockImport, diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..9704e16 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,13 @@ +import { + matchToFlat, + createESLintConfig, +} from '@putout/eslint-flat'; +import {safeAlign} from 'eslint-plugin-putout/config'; + +export const match = { + '**/{fresh,register.js}': { + 'n/no-unsupported-features/node-builtins': 'off', + }, +}; + +export default createESLintConfig([safeAlign, matchToFlat(match)]); diff --git a/lib/convert-imports/index.spec.js b/lib/convert-imports/index.spec.js index 4770c2f..a702814 100644 --- a/lib/convert-imports/index.spec.js +++ b/lib/convert-imports/index.spec.js @@ -1,9 +1,6 @@ import {createMockImport} from '../mock-import.js'; import {readFile} from 'node:fs/promises'; -import { - test, - stub, -} from 'supertape'; +import {test, stub} from 'supertape'; import {convertImports} from './index.js'; const {url} = import.meta; diff --git a/lib/mock-import.spec.js b/lib/mock-import.spec.js index f6fb091..8d7f4bc 100644 --- a/lib/mock-import.spec.js +++ b/lib/mock-import.spec.js @@ -1,8 +1,5 @@ import {readFile} from 'node:fs/promises'; -import { - test, - stub, -} from 'supertape'; +import {test, stub} from 'supertape'; import tryToCatch from 'try-to-catch'; import process from 'node:process'; import { @@ -302,7 +299,7 @@ test('mock-import: mockImport: transformSource: traceImport: reImport: nested', test('mock-import: reImport: native', async (t) => { const path = await reImport('path'); - const nativePath = await import('path'); + const nativePath = await import('node:path'); t.equal(path, nativePath); t.end(); diff --git a/package.json b/package.json index c14b9fe..8e10b41 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "license": "MIT", "devDependencies": { "@cloudcmd/stub": "^4.0.1", + "@putout/eslint-flat": "^2.0.0", "@putout/test": "^10.0.0", "c8": "^9.1.0", "check-dts": "^0.8.0",