main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /**
|
---|
2 | * @fileoverview Disallow the use of process.env()
|
---|
3 | * @author Vignesh Anand
|
---|
4 | * @deprecated in ESLint v7.0.0
|
---|
5 | */
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | //------------------------------------------------------------------------------
|
---|
9 | // Rule Definition
|
---|
10 | //------------------------------------------------------------------------------
|
---|
11 |
|
---|
12 | /** @type {import('../shared/types').Rule} */
|
---|
13 | module.exports = {
|
---|
14 | meta: {
|
---|
15 | deprecated: true,
|
---|
16 |
|
---|
17 | replacedBy: [],
|
---|
18 |
|
---|
19 | type: "suggestion",
|
---|
20 |
|
---|
21 | docs: {
|
---|
22 | description: "Disallow the use of `process.env`",
|
---|
23 | recommended: false,
|
---|
24 | url: "https://eslint.org/docs/latest/rules/no-process-env"
|
---|
25 | },
|
---|
26 |
|
---|
27 | schema: [],
|
---|
28 |
|
---|
29 | messages: {
|
---|
30 | unexpectedProcessEnv: "Unexpected use of process.env."
|
---|
31 | }
|
---|
32 | },
|
---|
33 |
|
---|
34 | create(context) {
|
---|
35 |
|
---|
36 | return {
|
---|
37 |
|
---|
38 | MemberExpression(node) {
|
---|
39 | const objectName = node.object.name,
|
---|
40 | propertyName = node.property.name;
|
---|
41 |
|
---|
42 | if (objectName === "process" && !node.computed && propertyName && propertyName === "env") {
|
---|
43 | context.report({ node, messageId: "unexpectedProcessEnv" });
|
---|
44 | }
|
---|
45 |
|
---|
46 | }
|
---|
47 |
|
---|
48 | };
|
---|
49 |
|
---|
50 | }
|
---|
51 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.