From 66f8e4b185949f8e96a01c81cd50b6992d32cd22 Mon Sep 17 00:00:00 2001 From: joelson brito Date: Fri, 7 Nov 2025 12:21:03 -0300 Subject: [PATCH] Migrate ESLint to flat config format (v9) and update CI workflow --- .github/workflows/ci.yml | 2 +- eslint.config.js | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 eslint.config.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c410225..d797e36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: npm ci - name: Run ESLint - run: npx eslint "src/**/*.ts" --ext .ts + run: npx eslint "src/**/*.ts" - name: Run Prettier check run: npx prettier --check "src/**/*.ts" "test/**/*.ts" diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..2a87abe --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,39 @@ +const js = require('@eslint/js'); +const parser = require('@typescript-eslint/parser'); +const plugin = require('@typescript-eslint/eslint-plugin'); +const prettierPlugin = require('eslint-plugin-prettier'); +const prettierConfig = require('eslint-config-prettier'); + +module.exports = [ + js.configs.recommended, + prettierConfig, + { + files: ['**/*.ts'], + languageOptions: { + parser: parser, + parserOptions: { + project: './tsconfig.json', + sourceType: 'module', + }, + globals: { + node: true, + jest: true, + }, + }, + plugins: { + '@typescript-eslint': plugin, + prettier: prettierPlugin, + }, + rules: { + ...plugin.configs.recommended.rules, + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-explicit-any': 'off', + 'prettier/prettier': 'error', + }, + }, + { + ignores: ['dist/**', 'node_modules/**', 'coverage/**'], + }, +];