eslint.config.js•2.73 kB
/*
* Copyright (C) 2025 TomTom NV
*
* 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.
*/
import eslint from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import prettierPlugin from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
export default [
{ ignores: ['**/node_modules/**', 'dist/**', 'coverage/**', 'build/**'] },
eslint.configs.recommended,
{
files: ['bin/**/*.js', 'eslint.config.js', 'jest.config.mjs', 'jest.setup.mjs'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
globals: {
process: 'readonly',
console: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
fetch: 'readonly',
URLSearchParams: 'readonly',
fail: 'readonly',
expect: 'readonly',
jest: 'readonly',
describe: 'readonly',
it: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
}
},
plugins: {
'@typescript-eslint': tseslint,
prettier: prettierPlugin
},
rules: {
...tseslint.configs.recommended.rules,
'@typescript-eslint/explicit-function-return-type': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}],
'no-console': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
'prefer-const': 'warn',
'prettier/prettier': 'off' // Turn off prettier warnings in ESLint
}
},
// Prettier config to disable conflicting rules
prettierConfig,
{
files: ['**/*.test.ts', '**/*.spec.ts', '**/tests/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off' // Less strict for tests
}
}
];