Skip to content

algotech/coding-standards-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coding-standards-javascript

Automatically adds linter rules into your project and checks the codings standards on git hooks.

Currently provides functionalities:

  • Automatically adds a best practices eslint config with the possibility to specify a local eslint config to overwrite existing rules.
  • Runs eslint in precommit, on staged files.

How to install

npm install --save-dev algotech/coding-standards-javascript

(Optionally) Specify the path of you local esliter config file relative to the project root, in package.json (custom-eslintrc-path property).

What to know before installing

By installing this project the following modifications will be made automatically to the project:

  • Will create an algotech-eslintrc.js file into the project /.git directory.
  • Will modify the package.json file with the following:
    • Will add a new script (if not already exists):
      "scripts": {
        <other scripts>
        "precommit": "lint-staged"
      }
    • Will add a "lint-staged" config (if not already exists):
      "lint-staged": {
        "*.js": [
          "eslint --config .git/algotech-eslintrc.js"
        ]
      }
    • Will add a "custom-eslintrc-path" property (if not already exists):
      "custom-eslintrc-path": ""

The precommit script is called every time a git precommit hook is executed, which is every time you create a new commit or update an existing one. In this case, lint-staged is run on all the staged files.

The lint-stage config specifies what to run for each type of staged file, in order to check the coding standards.

The custom-eslintrc-path is there to be modified by you. If you already have an eslint config file on the project and you want to keep that as top priority rules, you must specify the name of the file here. If the config file is not in the root directory, specify the relative path to the file, starting from the project root.

What to know before uninstalling

By installing this project the following modifications will be made automatically to the project:

  • Will delete the ./git/algotech-eslintrc.js config file.
  • Will modify the package.json file with the following:
    • Will remove the "precommit" script.
    • Will remove the "lint-staged" configuration.
    • Will remove the "custom-eslintrc-path" property.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published