mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-26 13:19:49 +07:00
Upgrade to ESLint 9 (#1149)
* Upgrade to eslint 9 * Fix version numbers in package.json files
This commit is contained in:
73
eslint.config.js
Normal file
73
eslint.config.js
Normal file
@@ -0,0 +1,73 @@
|
||||
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/**/*'
|
||||
]
|
||||
}
|
||||
];
|
||||
Reference in New Issue
Block a user