1 | const path = require('path')
|
2 |
|
3 | const { getGlobals } = require('eslint-plugin-mdx')
|
4 |
|
5 | const {
|
6 | allowModules,
|
7 | identity,
|
8 | isBrowserslistEnabled,
|
9 | isSrcDirAvailable,
|
10 | isWebpackAvailable,
|
11 | magicNumbers,
|
12 | webpackSpecVars,
|
13 | } = require('./_util')
|
14 |
|
15 | module.exports = {
|
16 | extends: [
|
17 | 'eslint:recommended',
|
18 | isBrowserslistEnabled && 'plugin:compat/recommended',
|
19 | 'plugin:import/recommended',
|
20 | 'plugin:node/recommended',
|
21 | 'plugin:promise/recommended',
|
22 | 'standard',
|
23 | 'plugin:prettier/recommended',
|
24 | 'prettier/standard',
|
25 | ].filter(identity),
|
26 | settings: {
|
27 | node: {
|
28 | allowModules,
|
29 | resolvePaths: isSrcDirAvailable && [path.resolve('src')],
|
30 | tryExtensions: [
|
31 | '.ts',
|
32 | '.tsx',
|
33 | '.vue',
|
34 | '.mjs',
|
35 | '.js',
|
36 | '.jsx',
|
37 | '.json',
|
38 | '.node',
|
39 | '.mdx',
|
40 | ],
|
41 | },
|
42 | },
|
43 | globals: isWebpackAvailable && getGlobals(webpackSpecVars),
|
44 | rules: {
|
45 | camelcase: [
|
46 | 2,
|
47 | {
|
48 | properties: 'never',
|
49 | ignoreDestructuring: true,
|
50 | allow: isWebpackAvailable && webpackSpecVars,
|
51 | },
|
52 | ],
|
53 | 'import/order': [
|
54 | 2,
|
55 | {
|
56 | 'newlines-between': 'always',
|
57 | },
|
58 | ],
|
59 | 'no-empty': [
|
60 | 2,
|
61 | {
|
62 | allowEmptyCatch: true,
|
63 | },
|
64 | ],
|
65 | 'no-empty-function': 2,
|
66 | 'no-magic-numbers': [
|
67 | 2,
|
68 | {
|
69 | enforceConst: true,
|
70 | ignore: magicNumbers,
|
71 | ignoreArrayIndexes: true,
|
72 | },
|
73 | ],
|
74 | 'node/no-unpublished-import': 0,
|
75 | 'node/no-unpublished-require': 0,
|
76 | 'prefer-const': 2,
|
77 | },
|
78 | }
|