/** * Copyright 2025 actions-toolkit authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* eslint-disable @typescript-eslint/no-require-imports */ const {defineConfig, globalIgnores} = require('eslint/config'); const {fixupConfigRules, fixupPluginRules} = require('@eslint/compat'); const typescriptEslint = require('@typescript-eslint/eslint-plugin'); const jestPlugin = require('eslint-plugin-jest'); const prettier = require('eslint-plugin-prettier'); const globals = require('globals'); const tsParser = require('@typescript-eslint/parser'); const js = require('@eslint/js'); const {FlatCompat} = require('@eslint/eslintrc'); // __dirname and __filename exist natively in CommonJS const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: js.configs.recommended, allConfig: js.configs.all }); module.exports = defineConfig([ globalIgnores(['.yarn/**/*', 'lib/**/*', 'coverage/**/*', 'node_modules/**/*']), { extends: fixupConfigRules( compat.extends( 'eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:import/errors', 'plugin:import/typescript', 'plugin:import/warnings', 'plugin:jest/recommended', 'plugin:prettier/recommended' ) ), plugins: { '@typescript-eslint': fixupPluginRules(typescriptEslint), jest: fixupPluginRules(jestPlugin), prettier: fixupPluginRules(prettier) }, languageOptions: { globals: { ...globals.node, ...globals.mocha, ...globals.jest }, parser: tsParser, ecmaVersion: 2023, sourceType: 'commonjs' }, rules: { '@typescript-eslint/no-require-imports': [ 'error', { allowAsImport: true } ], 'import/no-unresolved': [ 'error', { ignore: ['csv-parse/sync', '@octokit/openapi-types'] } ], 'jest/no-disabled-tests': 0 } } ]);