mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
67 lines
1.6 KiB
JavaScript
67 lines
1.6 KiB
JavaScript
const { browser: browserGlobals, node: nodeGlobals, jquery: jqueryGlobals } = (await import('globals')).default;
|
|
|
|
// File patterns to ignore
|
|
const IGNORED_FILES = [
|
|
'phpBB/assets/javascript/cropper.js',
|
|
'phpBB/assets/javascript/hermite.js',
|
|
'phpBB/assets/javascript/jquery-cropper.js',
|
|
'phpBB/**/*.min.js',
|
|
'phpBB/vendor/**/*.js',
|
|
'phpBB/vendor-ext/**/*.js',
|
|
'phpBB/phpbb/**/*.js',
|
|
'phpBB/tests/**/*.js',
|
|
];
|
|
|
|
// ESLint rule configurations
|
|
const FORMATTING_RULES = {
|
|
'quotes': ['error', 'single'],
|
|
'comma-dangle': ['error', 'always-multiline'],
|
|
'block-spacing': 'error',
|
|
'array-bracket-spacing': ['error', 'always'],
|
|
'object-curly-spacing': ['error', 'always'],
|
|
'space-before-function-paren': ['error', 'never'],
|
|
'space-in-parens': 'off',
|
|
};
|
|
|
|
const CODE_QUALITY_RULES = {
|
|
'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: '^_' }],
|
|
};
|
|
|
|
const DISABLED_STYLE_RULES = {
|
|
'multiline-comment-style': 'off',
|
|
'computed-property-spacing': 'off',
|
|
'capitalized-comments': 'off',
|
|
'no-lonely-if': 'off',
|
|
};
|
|
|
|
const mainConfig = {
|
|
files: ['**/*.js', '**/*.js.twig'],
|
|
linterOptions: {
|
|
reportUnusedDisableDirectives: false,
|
|
},
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
globals: {
|
|
...browserGlobals,
|
|
...nodeGlobals,
|
|
...jqueryGlobals,
|
|
},
|
|
},
|
|
rules: {
|
|
...FORMATTING_RULES,
|
|
...CODE_QUALITY_RULES,
|
|
...DISABLED_STYLE_RULES,
|
|
},
|
|
};
|
|
|
|
export default [
|
|
{ ignores: IGNORED_FILES },
|
|
mainConfig,
|
|
];
|