3.1.1 • Published 5 years ago

eslint-config-kam v3.1.1

Weekly downloads
8
License
MIT
Repository
bitbucket
Last release
5 years ago

KAM Javascript & Typescript standards (ESLint & Prettier)

Package to unify ESLint & Prettier versions and rules across projects. No need to install those packages anymore in your projects and maintain them all separately.

This package will provide you with eslint and Prettier and with the rules we follow at KAM.

Install

npm install -D eslint-config-kam

or

yarn add -D eslint-config-kam

Configure

  1. Create the file .eslintrc.js in your root folder and extend kam rules

    module.exports = {
        extends: 'eslint-config-kam',
    };
  2. Create the file .prettierrc.js in your root folder and extend kam rules

    module.exports = require('eslint-config-kam/.prettierrc.js');

Note: You can extend or modify this rules in your project as is described on the documentation of eslint, the same way as you will do when extending eslint recommended rules.

Usage

Like you will do normally with eslint, this package is nothing else but a wrapper.

  • For just linting and showing the report, run:
eslint path/to/folder

Note: The path can be a glob

  • For linting and autofix the problems, run:
eslint --fix path/to/folder
  • For linting also Typescript files, run:
eslint --ext ".js, .ts" path/to/folder

Note: The path can be a glob

Recommended

Add in your package.json at the scripts section the two following scripts:

{
    "scripts": {
        "eslint": "eslint --ext \".js, .ts\" path/to/folder",
        "eslint:fix": "eslint --ext \".js, .ts\" --fix path/to/folder"
    }
}

Configure your IDE to use eslint with this rules so you don't need to be running the scripts while developing.

For Prettier you have different options, depending on the IDE you can use a watcher, or manually run it for a file. We recommend to run linter tasks with a git hook, check how Husky works together with lint-staged.

KAM rules

Rules

Update the package

To update this package when a new version is ready, run:

npm update eslint-config-kam

or

yarn upgrade eslint-config-kam

Changelog

Changelog

Contributing

contributions welcome

Please remember to increment the version on package.json following the SemVer specification.

  1. Create a new branch from master following the next pattern:

    feature/[TICKET-NUM-]short-description

    Example: feature/KAM-123-add-rule-foobar

    Note: If there is no ticket then just do feature/add-rule-foobar

  2. Create a PR agains master. You will need to have at least one approval.

  3. When merging the PR to master, a Bitbucket pipeline will generate a new tag and push it. This tag number corresponds to the version npm uses to install/update the package (version in package.json). If the tag is created correctly, it will be automatically publish to the npm registry.

License

This software is licensed under the terms of the MIT license. See LICENSE.md for the full license.