diff --git a/Makefile b/Makefile index 143fe66..5c502f4 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ lib/maxmind : .PHONY : fmt fmt : bun x prettier --write . + bun x eslint --fix . @ git diff-index --quiet HEAD .PHONY : test diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..923344d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,30 @@ +// @ts-check + +import fs from 'node:fs'; + +import { eslint, typescript, spec } from 'eslint-config-nilfalse'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + { + ignores: ['eslint.config.js'].concat( + fs.readFileSync('.gitignore', 'utf8').split('\n').filter(Boolean), + ), + }, + { + settings: { + 'import/core-modules': ['bun:test'], + }, + }, + + ...eslint, + + { + files: ['**/*.ts', '**/*.tsx', '**/*.mts'], + ...typescript, + }, + { + files: ['**/*.spec.ts', '**/*.spec.tsx'], + ...spec, + }, +); diff --git a/package.json b/package.json index e1f8d11..b8264b5 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ }, "devDependencies": { "@types/bun": "latest", + "eslint-config-nilfalse": "github:nilfalse/eslint", "prettier": "^3.3.1", "webpack-cli": "^5.1.4" },