|
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 |
|
|---|
| 5 | Forbid 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 |
|
|---|
| 9 | This 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
|
|---|
| 18 | import fs from 'fs';
|
|---|
| 19 | import path from 'path';
|
|---|
| 20 |
|
|---|
| 21 | var fs = require('fs');
|
|---|
| 22 | var path = require('path');
|
|---|
| 23 | ```
|
|---|
| 24 |
|
|---|
| 25 | ### Pass
|
|---|
| 26 |
|
|---|
| 27 | ```js
|
|---|
| 28 | import _ from 'lodash';
|
|---|
| 29 | import foo from 'foo';
|
|---|
| 30 | import foo from './foo';
|
|---|
| 31 |
|
|---|
| 32 | var _ = require('lodash');
|
|---|
| 33 | var foo = require('foo');
|
|---|
| 34 | var foo = require('./foo');
|
|---|
| 35 |
|
|---|
| 36 | /* eslint import/no-nodejs-modules: ["error", {"allow": ["path"]}] */
|
|---|
| 37 | import path from 'path';
|
|---|
| 38 | ```
|
|---|
| 39 |
|
|---|
| 40 | ## When Not To Use It
|
|---|
| 41 |
|
|---|
| 42 | If you have a project that is run mainly or partially using Node.js.
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.