source: frontend/node_modules/eslint-plugin-import/docs/rules/no-nodejs-modules.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 829 bytes
Line 
1# import/no-nodejs-modules
2
3<!-- end auto-generated rule header -->
4
5Forbid the use of Node.js builtin modules. Can be useful for client-side web projects that do not have access to those modules.
6
7## Options
8
9This rule supports the following options:
10
11 - `allow`: Array of names of allowed modules. Defaults to an empty array.
12
13## Rule Details
14
15### Fail
16
17```js
18import fs from 'fs';
19import path from 'path';
20
21var fs = require('fs');
22var path = require('path');
23```
24
25### Pass
26
27```js
28import _ from 'lodash';
29import foo from 'foo';
30import foo from './foo';
31
32var _ = require('lodash');
33var foo = require('foo');
34var foo = require('./foo');
35
36/* eslint import/no-nodejs-modules: ["error", {"allow": ["path"]}] */
37import path from 'path';
38```
39
40## When Not To Use It
41
42If you have a project that is run mainly or partially using Node.js.
Note: See TracBrowser for help on using the repository browser.