@@ -52,96 +52,28 @@ var foo = require(FOO_NAME);
5252
5353#### allowModules
5454
55- Some platforms have additional embedded modules.
56- For example, Electron has ` electron ` module.
57-
58- We can specify additional embedded modules with this option.
59- This option is an array of strings as module names.
60-
61- ``` json
62- {
63- "rules" : {
64- "n/no-missing-require" : [" error" , {
65- "allowModules" : [" electron" ]
66- }]
67- }
68- }
69- ```
55+ This can be configured in the rule options or as a shared setting [ ` settings.allowModules ` ] ( ../shared-settings.md#allowmodules ) .
56+ Please see the shared settings documentation for more information.
7057
7158#### resolvePaths
7259
73- Adds additional paths to try for when resolving a require.
74- If a path is relative, it will be resolved from CWD.
75-
76- Default is ` [] `
60+ This can be configured in the rule options or as a shared setting [ ` settings.resolvePaths ` ] ( ../shared-settings.md#resolvepaths ) .
61+ Please see the shared settings documentation for more information.
7762
7863#### tryExtensions
7964
80- When an import path does not exist, this rule checks whether or not any of ` path.js ` , ` path.json ` , and ` path.node ` exists.
81- ` tryExtensions ` option is the extension list this rule uses at the time.
82-
83- Default is ` [".js", ".json", ".node"] ` .
84-
85- #### typescriptExtensionMap
86-
87- Adds the ability to change the extension mapping when converting between typescript and javascript
88-
89- You can also use the [ typescript compiler jsx options] ( https://www.typescriptlang.org/tsconfig#jsx ) to automatically use the correct mapping.
90-
91- If this option is left undefined we:
92-
93- 1 . Check the Shared Settings
94- 2 . Check your ` tsconfig.json ` ` compilerOptions.jsx `
95- 3 . Return the default mapping (jsx = ` preserve ` )
96-
97- Default is:
98-
99- ``` json
100- [
101- [ " " , " .js" ],
102- [ " .ts" , " .js" ],
103- [ " .cts" , " .cjs" ],
104- [ " .mts" , " .mjs" ],
105- [ " .tsx" , " .jsx" ],
106- ]
107- ```
65+ This can be configured in the rule options or as a shared setting [ ` settings.tryExtensions ` ] ( ../shared-settings.md#tryextensions ) .
66+ Please see the shared settings documentation for more information.
10867
10968#### tsconfigPath
11069
111- Adds the ability to specify the tsconfig used by the typescriptExtensionMap tool.
112-
113- ### Shared Settings
70+ This can be configured in the rule options or as a shared setting [ ` settings.tsconfigPath ` ] ( ../shared-settings.md#tsconfigpath ) .
71+ Please see the shared settings documentation for more information.
11472
115- The following options can be set by [ shared settings] ( http://eslint.org/docs/user-guide/configuring.html#adding-shared-settings ) .
116- Several rules have the same option, but we can set this option at once.
117-
118- - ` allowModules `
119- - ` resolvePaths `
120- - ` tryExtensions `
121- - ` typescriptExtensionMap `
73+ #### typescriptExtensionMap
12274
123- ``` js
124- // .eslintrc.js
125- module .exports = {
126- " settings" : {
127- " node" : {
128- " allowModules" : [" electron" ],
129- " resolvePaths" : [__dirname ],
130- " tryExtensions" : [" .js" , " .json" , " .node" ],
131- " typescriptExtensionMap" : [
132- [ " " , " .js" ],
133- [ " .ts" , " .js" ],
134- [ " .cts" , " .cjs" ],
135- [ " .mts" , " .mjs" ],
136- [ " .tsx" , " .js" ],
137- ]
138- }
139- },
140- " rules" : {
141- " n/no-missing-require" : " error"
142- }
143- }
144- ```
75+ This can be configured in the rule options or as a shared setting [ ` settings.typescriptExtensionMap ` ] ( ../shared-settings.md#typescriptextensionmap ) .
76+ Please see the shared settings documentation for more information.
14577
14678## 🔎 Implementation
14779
0 commit comments