|
| 1 | +/* |
| 2 | + * This file is part of the Symfony Webpack Encore package. |
| 3 | + * |
| 4 | + * (c) Fabien Potencier <[email protected]> |
| 5 | + * |
| 6 | + * For the full copyright and license information, please view the LICENSE |
| 7 | + * file that was distributed with this source code. |
| 8 | + */ |
| 9 | + |
| 10 | +const globals = require('globals'); |
| 11 | +const js = require('@eslint/js'); |
| 12 | +const nodePlugin = require('eslint-plugin-n'); |
| 13 | +const jsdoc = require('eslint-plugin-jsdoc'); |
| 14 | +const headers = require('eslint-plugin-headers'); |
| 15 | +const mocha = require('eslint-plugin-mocha').default; |
| 16 | + |
| 17 | +module.exports = [ |
| 18 | + js.configs.recommended, |
| 19 | + nodePlugin.configs['flat/recommended'], |
| 20 | + jsdoc.configs['flat/recommended'], |
| 21 | + mocha.configs.recommended, |
| 22 | + { |
| 23 | + plugins: { |
| 24 | + headers, |
| 25 | + }, |
| 26 | + languageOptions: { |
| 27 | + ecmaVersion: 2021, |
| 28 | + globals: { |
| 29 | + ...globals.browser, |
| 30 | + ...globals.node, |
| 31 | + }, |
| 32 | + }, |
| 33 | + ignores: ['lib/webpack-manifest-plugin'] |
| 34 | + }, |
| 35 | + { |
| 36 | + 'rules': { |
| 37 | + 'quotes': ['error', 'single'], |
| 38 | + 'no-undef': 'error', |
| 39 | + 'no-extra-semi': 'error', |
| 40 | + 'semi': 'error', |
| 41 | + 'no-template-curly-in-string': 'error', |
| 42 | + 'no-caller': 'error', |
| 43 | + 'eqeqeq': 'error', |
| 44 | + 'global-require': 'off', |
| 45 | + 'brace-style': 'error', |
| 46 | + 'eol-last': 'error', |
| 47 | + 'indent': ['error', 4, { 'SwitchCase': 1 }], |
| 48 | + 'no-extra-bind': 'warn', |
| 49 | + 'no-empty': 'off', |
| 50 | + 'no-multiple-empty-lines': 'error', |
| 51 | + 'no-multi-spaces': 'error', |
| 52 | + 'no-process-exit': 'warn', |
| 53 | + 'space-in-parens': 'error', |
| 54 | + 'no-trailing-spaces': 'error', |
| 55 | + 'no-use-before-define': 'off', |
| 56 | + 'no-unused-vars': ['error', { 'args': 'none' }], |
| 57 | + 'key-spacing': 'error', |
| 58 | + 'space-infix-ops': 'error', |
| 59 | + 'no-unsafe-negation': 'error', |
| 60 | + 'no-loop-func': 'warn', |
| 61 | + 'space-before-function-paren': ['error', 'never'], |
| 62 | + 'space-before-blocks': 'error', |
| 63 | + 'object-curly-spacing': ['error', 'always'], |
| 64 | + 'keyword-spacing': ['error', { |
| 65 | + 'after': true |
| 66 | + }], |
| 67 | + 'no-console': 'off', |
| 68 | + 'jsdoc/require-jsdoc': 'off', |
| 69 | + 'jsdoc/require-param-description': 'off', |
| 70 | + 'jsdoc/require-property-description': 'off', |
| 71 | + 'jsdoc/require-returns-description': 'off', |
| 72 | + 'jsdoc/tag-lines': ['warn', 'never', { |
| 73 | + 'startLines': 1 |
| 74 | + }], |
| 75 | + 'n/no-unsupported-features/node-builtins': ['error'], |
| 76 | + 'n/no-deprecated-api': 'error', |
| 77 | + 'n/no-missing-import': 'error', |
| 78 | + 'n/no-missing-require': [ |
| 79 | + 'error', |
| 80 | + { |
| 81 | + 'allowModules': [ |
| 82 | + 'webpack' |
| 83 | + ] |
| 84 | + } |
| 85 | + ], |
| 86 | + 'n/no-unpublished-bin': 'error', |
| 87 | + 'n/no-unpublished-require': 'error', |
| 88 | + 'n/process-exit-as-throw': 'error', |
| 89 | + 'headers/header-format': ['error', { |
| 90 | + source: 'string', |
| 91 | + content: `This file is part of the Symfony Webpack Encore package. |
| 92 | +
|
| 93 | +(c) Fabien Potencier <[email protected]> |
| 94 | +
|
| 95 | +For the full copyright and license information, please view the LICENSE |
| 96 | +file that was distributed with this source code.`, |
| 97 | + blockPrefix: '\n', |
| 98 | + }] |
| 99 | + }, |
| 100 | + 'settings': { |
| 101 | + 'jsdoc': { |
| 102 | + 'mode': 'typescript' |
| 103 | + } |
| 104 | + }, |
| 105 | + }, |
| 106 | + { |
| 107 | + 'files': ['.eslintrc.js'], |
| 108 | + 'rules': { |
| 109 | + 'quotes': ['error', 'double'], |
| 110 | + }, |
| 111 | + }, |
| 112 | + { |
| 113 | + 'files': ['test/**/*'], |
| 114 | + languageOptions: { |
| 115 | + globals: { |
| 116 | + // For Puppeteer when calling "page.evaluate()" |
| 117 | + document: 'readonly', |
| 118 | + }, |
| 119 | + }, |
| 120 | + rules: { |
| 121 | + 'mocha/no-setup-in-describe': 'off', |
| 122 | + } |
| 123 | + } |
| 124 | +]; |
0 commit comments