|
| 1 | +import githubPlugin from 'eslint-plugin-github' |
| 2 | +import {fixupPluginRules} from '@eslint/compat' |
| 3 | +import customElementsPlugin from 'eslint-plugin-custom-elements' |
| 4 | +import globals from 'globals' |
| 5 | + |
| 6 | +const githubFlatConfigs = githubPlugin.getFlatConfigs() |
| 7 | + |
| 8 | +const customElementsRules = Object.fromEntries( |
| 9 | + Object.keys(customElementsPlugin.rules).map(r => [`custom-elements/${r}`, 'error']), |
| 10 | +) |
| 11 | + |
| 12 | +export default [ |
| 13 | + {ignores: ['dist']}, |
| 14 | + githubFlatConfigs.browser, |
| 15 | + githubFlatConfigs.recommended, |
| 16 | + ...githubFlatConfigs.typescript, |
| 17 | + { |
| 18 | + plugins: { |
| 19 | + 'custom-elements': fixupPluginRules(customElementsPlugin), |
| 20 | + }, |
| 21 | + languageOptions: { |
| 22 | + globals: { |
| 23 | + FileAttachmentElement: 'readonly', |
| 24 | + }, |
| 25 | + }, |
| 26 | + rules: { |
| 27 | + ...customElementsRules, |
| 28 | + '@typescript-eslint/no-explicit-any': 'off', |
| 29 | + 'custom-elements/tag-name-matches-class': ['error', {suffix: 'Element'}], |
| 30 | + }, |
| 31 | + }, |
| 32 | + { |
| 33 | + files: ['test/**/*.js'], |
| 34 | + languageOptions: { |
| 35 | + globals: { |
| 36 | + ...globals.mocha, |
| 37 | + ...globals.chai, |
| 38 | + }, |
| 39 | + }, |
| 40 | + rules: { |
| 41 | + 'github/unescaped-html-literal': 'off', |
| 42 | + 'github/no-inner-html': 'off', |
| 43 | + 'import/extensions': 'off', |
| 44 | + 'import/no-unresolved': 'off', |
| 45 | + 'one-var': 'off', |
| 46 | + }, |
| 47 | + }, |
| 48 | +] |
0 commit comments