ESLINT Configuration - SmartOffice-Legends/pet-health-care GitHub Wiki

This page is created for following configuration changes and giving a general overlook of Eslint configuration file eslintrc.json

  • In this project Eslint is also used for code styling using airbnb style guide.

  • Test linting is enabled for jasmine.

  • Test linting is using es2021.

  • Test linting is used for browsers.

  • .eslintignore file can be used for making Eslint ignore files.

  • .vscode/settings.json auto detects problems at each file save and corrects them if possible and validation is set for typescript.

{ "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "eslint.validate": ["typescript"] }

Eslint Usage and configuration steps can be accessed from the link.

Eslint cli options can be accessed from the link.

Rules used at this project

  1. "no-duplicate-imports": "error"

    Disallow duplicate module imports

  2. "no-unused-private-class-members": "error"

    Disallow unused private class members

  3. "no-use-before-define": "error"

    Disallow the use of variables before they are defined

  4. "require-atomic-updates": "error"

    Disallow assignments that can lead to race conditions due to usage of await or yield

  5. "arrow-body-style": ["error", "always"]

    Require braces around arrow function bodies

  6. "camelcase": ["error", {"properties": "always"}]

    Enforce camelcase naming convention

  7. "capitalized-comments": ["error", "always"]

    Enforce or disallow capitalization of the first letter of a comment

  8. "complexity": "error"

    Enforce a maximum cyclomatic complexity allowed in a program

  9. "eqeqeq": "error"

    Require the use of === and !==

  10. "prefer-const": "error"

    Require const declarations for variables that are never reassigned after declared

  11. "require-await": "error"

    Disallow async functions which have no await expression

  12. "spaced-comment": ["error", "always"]

    Enforce consistent spacing after the "//" or "/*" in a comment

  13. "arrow-parens": ["error", "always"]

    Require parentheses around arrow function arguments

  14. "max-len": ["error", { "code": 180 }]

    Enforce a maximum line length

  15. "import/prefer-default-export": "off"

    When there is only a single export from a module, prefer using default export over named export.

  16. "no-console": "off"

    Disallow the use of console