|
6 | 6 |
|
7 | 7 | # plugin:n/recommended-module disables some globals we still want |
8 | 8 | globals: |
| 9 | + # TODO: detect if project is type: module or not and remove the globals if so |
9 | 10 | __dirname: 'readonly' |
10 | 11 | __filename: 'readonly' |
11 | 12 | require: 'readonly' |
12 | 13 |
|
13 | 14 | rules: |
14 | 15 | # node has a consistent radix for parseInt |
15 | 16 | radix: 'off' |
| 17 | + |
16 | 18 | # we should be reading any env config into a specific config module |
17 | 19 | n/no-process-env: 'error' |
| 20 | + |
18 | 21 | # enforce return upon a callback |
19 | 22 | n/callback-return: ['error', ['callback', 'cb', 'next']] |
| 23 | + |
20 | 24 | # disallow require() outside of the top-level module scope |
21 | 25 | n/global-require: 'error' |
| 26 | + |
22 | 27 | # enforces error handling in callbacks |
23 | 28 | n/handle-callback-err: ['error', '^.*[eE]rr(or)?$'] |
| 29 | + |
24 | 30 | # disallow mixing regular variable and require declarations |
25 | 31 | n/no-mixed-requires: 'error' |
| 32 | + |
26 | 33 | # disallow use of new operator with the require function |
27 | 34 | n/no-new-require: 'error' |
| 35 | + |
28 | 36 | # disallow string concatenation with __dirname and __filename |
29 | 37 | n/no-path-concat: 'error' |
| 38 | + |
30 | 39 | # restrict usage of specified node modules |
31 | 40 | n/no-restricted-import: 'off' |
32 | 41 | n/no-restricted-require: 'off' |
| 42 | + |
33 | 43 | # disallow use of synchronous methods |
34 | 44 | n/no-sync: 'error' |
| 45 | + |
35 | 46 | # defer to import/no-extraneous-dependencies |
36 | 47 | n/no-extraneous-import: 'off' |
37 | 48 | n/no-extraneous-require: 'off' |
| 49 | + |
38 | 50 | # use `module.exports` for commonjs |
39 | 51 | n/exports-style: ['error', 'module.exports'] |
| 52 | + |
40 | 53 | # use imports instead of globals |
41 | 54 | n/prefer-global/text-decoder: ['error', 'never'] |
42 | 55 | n/prefer-global/text-encoder: ['error', 'never'] |
43 | 56 | n/prefer-global/url-search-params: ['error', 'never'] |
44 | 57 | n/prefer-global/url: ['error', 'never'] |
| 58 | + |
45 | 59 | # use promise APIs |
46 | 60 | n/prefer-promises/dns: 'error' |
47 | 61 | n/prefer-promises/fs: 'error' |
| 62 | + |
48 | 63 | # make sure callbacks pass error as 1st param |
49 | 64 | n/no-callback-literal: 'error' |
0 commit comments