chrome-extensions-samples/eslint.config.js

74 строки
1.7 KiB
JavaScript
Исходник Постоянная ссылка Обычный вид История

const js = require('@eslint/js');
const globals = require('globals');
const prettier = require('eslint-plugin-prettier');
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
const jest = require('eslint-plugin-jest');
module.exports = [
js.configs.recommended,
eslintPluginPrettierRecommended,
{
plugins: {
prettier
},
rules: {
'prettier/prettier': ['error'],
'no-var': ['error'],
'no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}
]
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.webextensions,
...globals.es2021,
...globals.jquery,
...globals.serviceworker
}
}
},
{
files: [
'functional-samples/tutorial.puppeteer/**/*',
'functional-samples/tutorial.terminate-sw/**/*'
],
plugins: { jest },
rules: {
...jest.configs['flat/recommended'].rules
},
languageOptions: {
globals: {
...globals.jest
}
},
settings: {
jest: {
version: '29.7.0'
}
}
},
{
// Ignores must be in a separate block to apply globally:
// https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores
ignores: [
'eslint.config.js',
'.repo/**/*',
'_archive/**/*',
'**/third-party/**',
'**/node_modules/**/*',
// These are autogenerated files that we shouldn't lint
'functional-samples/cookbook.wasm-helloworld-print/wasm/pkg/**/*',
'functional-samples/cookbook.wasm-helloworld-print-nomodule/wasm/pkg/**/*'
]
}
];