diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index b19ad393..00000000 --- a/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -dist -coverage -reports/mutation -.eslintrc.js -/generic-type-guard.* diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index a213fe89..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "root": true, - "extends": ["@mscharley", "@mscharley/eslint-config/node"] -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05c91e60..3e0e48f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: uses: mscharley/.github/.github/workflows/node-ci.yml@main strategy: matrix: - node-version: [16.x, 18.x, 20.x, 22.x, current] + node-version: [18.x, 20.x, 22.x, current] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ with: node-version: ${{ matrix.node-version }} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..df703324 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,16 @@ +import { configs } from "@mscharley/eslint-config"; + +export default [ + ...configs.recommended, + ...configs.node, + { + ignores: [ + 'node_modules', + 'dist', + 'coverage', + 'reports/mutation', + 'eslint.config.js', + 'generic-type-guard.*', + ], + }, +]; diff --git a/package.json b/package.json index 6f374fd0..1f5897c9 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,9 @@ "prepack": "npm run clean && npm run build", "test": "npm run lint && npm run mocha && git diff --name-only --exit-code", "test-watch": "nodemon -e ts,json --exec npm run test", - "lint": "eslint . --ext .js,.jsx,.ts,.tsx", - "lint-fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx", - "lint-watch": "nodemon -e ts,json --exec eslint . --ext .js,.jsx,.ts,.tsx", + "lint": "eslint", + "lint-fix": "eslint", + "lint-watch": "nodemon -e ts,json --exec eslint", "mocha": "c8 mocha 'src/**/*.spec.ts'", "mocha-watch": "nodemon -e ts,json --exec npm run mocha 'src/**/*.spec.ts'", "stryker": "stryker run", diff --git a/src/primitives.spec.ts b/src/primitives.spec.ts index efd5c6d1..a40074e9 100644 --- a/src/primitives.spec.ts +++ b/src/primitives.spec.ts @@ -151,7 +151,7 @@ describe('Primitives', function (this: Mocha.Suite) { }); it('narrowValue', () => { - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated const narrow = p.narrowValue(p.isString, p.isSingletonString('foo')); expect(narrow('foo')).to.equal(true); @@ -266,9 +266,9 @@ describe('Primitives', function (this: Mocha.Suite) { }); it('never', () => { - // eslint-disable-next-line @typescript-eslint/ban-types + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type const fn: Function = p.isNever; - // eslint-disable-next-line @typescript-eslint/no-unsafe-return + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call expect(() => fn('Oops!')).to.throw('Unexpected value when expecting never: Oops!'); }); }); diff --git a/src/primitives.ts b/src/primitives.ts index e56fe01f..bd03b403 100644 --- a/src/primitives.ts +++ b/src/primitives.ts @@ -301,5 +301,6 @@ export const isUnknown = isAny; * @public */ export const isNever = (n: never): never => { + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions throw Error(`Unexpected value when expecting never: ${n}`); };