blob: 225adab22221b508ce51c9ea56b27c025cc522fa [file] [log] [blame] [view]
Tim van der Lippefdbd42e2020-04-07 14:14:361# import/no-nodejs-modules: No Node.js builtin modules
2
3Forbid the use of Node.js builtin modules. Can be useful for client-side web projects that do not have access to those modules.
4
5### Options
6
7This rule supports the following options:
8
9- `allow`: Array of names of allowed modules. Defaults to an empty array.
10
11## Rule Details
12
13### Fail
14
15```js
16import fs from 'fs';
17import path from 'path';
18
19var fs = require('fs');
20var path = require('path');
21```
22
23### Pass
24
25```js
26import _ from 'lodash';
27import foo from 'foo';
28import foo from './foo';
29
30var _ = require('lodash');
31var foo = require('foo');
32var foo = require('./foo');
33
34/* eslint import/no-nodejs-modules: ["error", {"allow": ["path"]}] */
35import path from 'path';
36```
37
38## When Not To Use It
39
40If you have a project that is run mainly or partially using Node.js.