[ticket/17517] Update to latest eslint

PHPBB-17517
This commit is contained in:
Matt Friedman 2025-05-31 11:15:04 -07:00
parent 1210c5a03d
commit 216b71df9a
No known key found for this signature in database
3 changed files with 3989 additions and 479 deletions

87
eslint.config.mjs Normal file
View file

@ -0,0 +1,87 @@
// eslint.config.mjs
// Use Promise.all for parallel imports to improve loading performance
const [
{ default: globalsAll },
{ default: unicorn },
{ default: importPlugin },
{ default: nodePlugin },
{ default: promisePlugin },
] = await Promise.all([
import('globals'),
import('eslint-plugin-unicorn'),
import('eslint-plugin-import'),
import('eslint-plugin-n'),
import('eslint-plugin-promise'),
]);
export default [
// 🔒 Global ignore block — applies BEFORE any parsing
{
ignores: [
'phpBB/assets/javascript/cropper.js',
'phpBB/assets/javascript/hermite.js',
'phpBB/assets/javascript/jquery-cropper.js',
'phpBB/ext/**/*.js',
'phpBB/**/*.min.js',
'phpBB/vendor/**/*.js',
'phpBB/vendor-ext/**/*.js',
'phpBB/phpbb/**/*.js',
'phpBB/tests/**/*.js',
],
},
// 🌐 Main config for your source files
{
files: ['**/*.js'],
linterOptions: {
reportUnusedDisableDirectives: false,
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globalsAll.browser,
...globalsAll.node,
...globalsAll.jquery,
},
},
plugins: {
unicorn,
import: importPlugin,
n: nodePlugin,
promise: promisePlugin,
},
rules: {
// Your personal customizations
'quotes': ['error', 'single'],
'comma-dangle': ['error', 'always-multiline'],
'block-spacing': 'error',
'array-bracket-spacing': ['error', 'always'],
'multiline-comment-style': 'off',
'computed-property-spacing': 'off',
'space-before-function-paren': ['error', 'never'],
'space-in-parens': 'off',
'capitalized-comments': 'off',
'object-curly-spacing': ['error', 'always'],
'no-lonely-if': 'off',
'unicorn/prefer-module': 'off',
// XO-inspired defaults
'semi': ['error', 'always'],
'eqeqeq': ['error', 'always'],
'curly': ['error', 'multi-line'],
'no-var': 'error',
'prefer-const': 'error',
'no-console': 'off',
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'unicorn/filename-case': ['off', { case: 'kebabCase' }],
'unicorn/no-null': 'off',
'unicorn/prefer-ternary': 'off',
'unicorn/no-array-for-each': 'off',
'import/order': ['error', { 'newlines-between': 'always' }],
'n/no-missing-import': 'error',
'promise/always-return': 'off',
},
},
];

4324
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,55 +6,6 @@
"directories": {
"doc": "docs"
},
"eslintConfig": {
"extends": "xo",
"ignorePatterns": [
"phpBB/assets/javascript/cropper.js",
"phpBB/assets/javascript/hermite.js",
"phpBB/assets/javascript/jquery-cropper.js",
"phpBB/ext/**/*.js",
"phpBB/**/*.min.js",
"phpBB/vendor/**/*.js",
"phpBB/vendor-ext/**/*.js",
"phpBB/phpbb/**/*.js",
"phpBB/tests/**/*.js"
],
"rules": {
"quotes": [
"error",
"single"
],
"comma-dangle": [
"error",
"always-multiline"
],
"block-spacing": "error",
"array-bracket-spacing": [
"error",
"always"
],
"multiline-comment-style": "off",
"computed-property-spacing": "off",
"space-before-function-paren": [
"error",
"never"
],
"space-in-parens": "off",
"capitalized-comments": "off",
"object-curly-spacing": [
"error",
"always"
],
"no-lonely-if": "off",
"unicorn/prefer-module": "off"
},
"env": {
"es6": true,
"browser": true,
"node": true,
"jquery": true
}
},
"browserslist": [
"> 1%",
"not ie 11",
@ -91,8 +42,12 @@
"devDependencies": {
"autoprefixer": "^10.4.4",
"cssnano": "^5.1.7",
"eslint": "^8.13.0",
"eslint-config-xo": "^0.40.0",
"eslint": "^9.28.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.18.0",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-unicorn": "^59.0.1",
"globals": "^16.2.0",
"gulp": "^5.0.0",
"gulp-concat": "^2.6.1",
"gulp-postcss": "^9.0.1",