whatsapp-web.js/eslint.config.mjs
Maksim Koryukov 211205363c
fix(deps): upgrade eslint and plugins to 9.39.4 (#201701)
* fix(deps): upgrade eslint and plugins to 10.2.0

* chore: manual lint-fix

* chore: automatic lint-fix

* feat(repo): github actions - lint - use node v24

because it is linting (not runtime), so why not
to use the latest stable Node version

* fix: remove @stylistic/eslint-plugin (in favor of prettier)

* fix: eslint uses `ecmaVersion` 2025

* fix: eslint's "mocha" config is isolated (for test files only)

for example `describe` is not considered "global" outside the
test files. the same for all other "eslint/mocha" rules -
they are applied only to files in `/tests` folder.

* chore: update package-lock.json after eslint upgrade
2026-04-18 17:50:05 -03:00

67 lines
1.9 KiB
JavaScript

import globals from 'globals';
import pluginEslintJs from '@eslint/js';
import pluginMocha from 'eslint-plugin-mocha';
import configEslintConfigPrettier from 'eslint-plugin-prettier/recommended';
export default [
pluginEslintJs.configs.recommended,
{
name: 'whatsapp-web.js/default/rules',
plugins: {
mocha: pluginMocha,
},
languageOptions: {
ecmaVersion: 2025,
globals: {
...globals.browser,
...globals.commonjs,
...globals.es6,
...globals.node,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
},
rules: {
'no-unused-vars': [
'error',
{
// TODO: args can be uncommented, but there is code, that causes lint-errors
// args: 'all',
vars: 'all',
caughtErrorsIgnorePattern: '^ignoredError',
},
],
},
},
{
// be careful, "recommended" settings object has 4 fields:
// - name (string)
// - plugins (object)
// - languageOptions (object)
// - rules (object)
//
// by simple "adding" any of mentioned fields to this object
// you REPLACE the "recommended" value.
// If you want to PATCH it - consider nested "..." spread operator
...pluginMocha.configs.recommended,
name: 'whatsapp-web.js/default/mocha',
files: ['tests/**/*'],
},
{
name: 'whatsapp-web.js/default/ignores',
ignores: [
'node_modules',
'dist',
'coverage',
'docs',
'*.min.js',
'.wa-version',
'.wwebjs_auth',
'.wwebjs_cache',
],
},
configEslintConfigPrettier,
];