Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

no-process-env.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @fileoverview Disallow the use of process.env()
  3. * @author Vignesh Anand
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. type: "suggestion",
  12. docs: {
  13. description: "disallow the use of `process.env`",
  14. category: "Node.js and CommonJS",
  15. recommended: false,
  16. url: "https://eslint.org/docs/rules/no-process-env"
  17. },
  18. schema: []
  19. },
  20. create(context) {
  21. return {
  22. MemberExpression(node) {
  23. const objectName = node.object.name,
  24. propertyName = node.property.name;
  25. if (objectName === "process" && !node.computed && propertyName && propertyName === "env") {
  26. context.report({ node, message: "Unexpected use of process.env." });
  27. }
  28. }
  29. };
  30. }
  31. };