1 | const { getGlobals } = require('eslint-plugin-mdx')
|
2 |
|
3 | const {
|
4 | allowModules,
|
5 | camelCaseRule,
|
6 | isWebpackAvailable,
|
7 | magicNumbers,
|
8 | webpackSpecVars,
|
9 | } = require('./_util')
|
10 |
|
11 | module.exports = {
|
12 | extends: [
|
13 | 'eslint:recommended',
|
14 | 'plugin:import/recommended',
|
15 | 'plugin:node/recommended',
|
16 | 'plugin:promise/recommended',
|
17 | 'plugin:sonarjs/recommended',
|
18 | 'plugin:unicorn/recommended',
|
19 | 'standard',
|
20 | 'plugin:prettier/recommended',
|
21 | 'prettier/standard',
|
22 | 'prettier/unicorn',
|
23 | ],
|
24 | settings: {
|
25 | node: {
|
26 | allowModules,
|
27 | tryExtensions: [
|
28 | '.ts',
|
29 | '.tsx',
|
30 | '.vue',
|
31 | '.mjs',
|
32 | '.js',
|
33 | '.jsx',
|
34 | '.json',
|
35 | '.node',
|
36 | '.mdx',
|
37 | ],
|
38 | },
|
39 | },
|
40 | globals: isWebpackAvailable ? getGlobals(webpackSpecVars) : undefined,
|
41 | rules: {
|
42 | camelcase: camelCaseRule,
|
43 | 'import/order': [
|
44 | 2,
|
45 | {
|
46 | 'newlines-between': 'always',
|
47 | },
|
48 | ],
|
49 | 'no-empty': [
|
50 | 2,
|
51 | {
|
52 | allowEmptyCatch: true,
|
53 | },
|
54 | ],
|
55 | 'no-empty-function': 2,
|
56 | 'no-magic-numbers': [
|
57 | 2,
|
58 | {
|
59 | enforceConst: true,
|
60 | ignore: magicNumbers,
|
61 | ignoreArrayIndexes: true,
|
62 | },
|
63 | ],
|
64 | 'node/no-unsupported-features/es-syntax': 0,
|
65 | 'node/no-unsupported-features/node-builtins': 0,
|
66 | 'node/no-unpublished-import': 0,
|
67 | 'node/no-unpublished-require': 0,
|
68 | 'prefer-const': 2,
|
69 | 'unicorn/catch-error-name': [
|
70 | 2,
|
71 | {
|
72 | name: 'error',
|
73 | caughtErrorsIgnorePattern: '^e(rr)?$',
|
74 | },
|
75 | ],
|
76 | 'unicorn/filename-case': [
|
77 | 2,
|
78 | {
|
79 | cases: {
|
80 | kebabCase: true,
|
81 | pascalCase: true,
|
82 | },
|
83 |
|
84 | ignore: [/^[A-Z](([\dA-Z]+_)*[\dA-Z]+)?\.mdx?$/],
|
85 | },
|
86 | ],
|
87 | 'unicorn/prevent-abbreviations': 0,
|
88 | },
|
89 | }
|