1 | const path = require('path')
|
2 |
|
3 | const { getGlobals } = require('eslint-plugin-mdx')
|
4 |
|
5 | const {
|
6 | allowModules,
|
7 | isSrcDirAvailable,
|
8 | isWebpackAvailable,
|
9 | magicNumbers,
|
10 | webpackSpecVars,
|
11 | } = require('./_util')
|
12 |
|
13 | module.exports = {
|
14 | extends: [
|
15 | 'eslint:recommended',
|
16 | 'plugin:import/recommended',
|
17 | 'plugin:node/recommended',
|
18 | 'plugin:promise/recommended',
|
19 | 'standard',
|
20 | 'plugin:prettier/recommended',
|
21 | 'prettier/standard',
|
22 | ],
|
23 | settings: {
|
24 | node: {
|
25 | allowModules,
|
26 | resolvePaths: isSrcDirAvailable && [path.resolve('src')],
|
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),
|
41 | rules: {
|
42 | camelcase: [
|
43 | 2,
|
44 | {
|
45 | properties: 'never',
|
46 | ignoreDestructuring: true,
|
47 | allow: isWebpackAvailable && webpackSpecVars,
|
48 | },
|
49 | ],
|
50 | 'import/order': [
|
51 | 2,
|
52 | {
|
53 | 'newlines-between': 'always',
|
54 | },
|
55 | ],
|
56 | 'no-empty': [
|
57 | 2,
|
58 | {
|
59 | allowEmptyCatch: true,
|
60 | },
|
61 | ],
|
62 | 'no-empty-function': 2,
|
63 | 'no-magic-numbers': [
|
64 | 2,
|
65 | {
|
66 | enforceConst: true,
|
67 | ignore: magicNumbers,
|
68 | ignoreArrayIndexes: true,
|
69 | },
|
70 | ],
|
71 | 'node/no-unsupported-features/es-syntax': 0,
|
72 | 'node/no-unsupported-features/node-builtins': 0,
|
73 | 'node/no-unpublished-import': 0,
|
74 | 'node/no-unpublished-require': 0,
|
75 | 'prefer-const': 2,
|
76 | },
|
77 | }
|