|
| 1 | +import mocha from 'eslint-plugin-mocha'; |
| 2 | +import babel from '@babel/eslint-plugin'; |
| 3 | +import globals from 'globals'; |
| 4 | +import babelParser from '@babel/eslint-parser'; |
| 5 | +import path from 'node:path'; |
| 6 | +import { fileURLToPath } from 'node:url'; |
| 7 | +import js from '@eslint/js'; |
| 8 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 9 | + |
| 10 | +const __filename = fileURLToPath(import.meta.url); |
| 11 | +const __dirname = path.dirname(__filename); |
| 12 | +const compat = new FlatCompat({ |
| 13 | + baseDirectory: __dirname, |
| 14 | + recommendedConfig: js.configs.recommended, |
| 15 | + allConfig: js.configs.all |
| 16 | +}); |
| 17 | + |
| 18 | +export default [{ |
| 19 | + ignores: [ |
| 20 | + '**/.DS_Store', |
| 21 | + '**/_sass', |
| 22 | + '**/_site', |
| 23 | + '**/coverage', |
| 24 | + 'dist/*', |
| 25 | + '**/node_modules', |
| 26 | + '**/package-lock.json', |
| 27 | + 'packages/*/dist/*', |
| 28 | + '**/.env', |
| 29 | + '**/.env.*', |
| 30 | + '!**/.env.example', |
| 31 | + ], |
| 32 | +}, ...compat.extends('eslint:recommended', 'plugin:mocha/recommended'), { |
| 33 | + plugins: { |
| 34 | + mocha, |
| 35 | + '@babel': babel, |
| 36 | + }, |
| 37 | + |
| 38 | + languageOptions: { |
| 39 | + globals: { |
| 40 | + ...globals.browser, |
| 41 | + ...globals.node, |
| 42 | + ...globals.jquery, |
| 43 | + ...globals.amd, |
| 44 | + ...globals.mocha, |
| 45 | + __base: false, |
| 46 | + expect: false, |
| 47 | + }, |
| 48 | + |
| 49 | + parser: babelParser, |
| 50 | + ecmaVersion: 6, |
| 51 | + sourceType: 'module', |
| 52 | + |
| 53 | + parserOptions: { |
| 54 | + requireConfigFile: false, |
| 55 | + }, |
| 56 | + }, |
| 57 | + |
| 58 | + rules: { |
| 59 | + curly: 2, |
| 60 | + eqeqeq: ['error', 'smart'], |
| 61 | + quotes: [2, 'single', 'avoid-escape'], |
| 62 | + semi: 2, |
| 63 | + |
| 64 | + 'no-unused-vars': ['error', { |
| 65 | + caughtErrors: 'none', |
| 66 | + varsIgnorePattern: 'should|expect', |
| 67 | + }], |
| 68 | + |
| 69 | + 'mocha/no-mocha-arrows': 0, |
| 70 | + }, |
| 71 | +}]; |
0 commit comments