@itcase/lint

1.0.16 • Public • Published

ITCase Lint

Presets of linter configurations

Installation

$ npm i -D @itcase/lint eslint stylelint prettier

Usage

ESLint

Create a eslint.config.mjs configuration file in the root of your project with the following content:

import eslint from '@itcase/lint/eslint/index.js'

export default eslint

ESLint with MobX

Create a eslint.config.mjs configuration file in the root of your project with the following content:

import eslint from '@itcase/lint/eslint/index.js'
import eslintMobx from '@itcase/lint/eslint/mobx/index.js'

export default [...eslint, ...eslintMobx]

Stylelint

Create a eslint.config.mjs configuration file in the root of your project with the following content:

export default {
  extends: ['@itcase/lint/stylelint/index.js'],
}

Prettier

Create a prettier.config.mjs configuration file in the root of your project with the following content:

import prettier from '@itcase/lint/prettier/index.js'

export default prettier

git-hook

  1. Use husky and lint-staged
npm i -D husky lint-staged
  1. Create a .lintstagedrc configuration file in the root of your project with the following content:
{
  "*.css": ["npx stylelint --fix"],
  "*.(js|jsx|ts|tsx)": ["npx eslint --fix"]
}
  1. Add pre-commit hook in .husky/pre-commit
#!/bin/bash

if grep --include=*.{json,css,html} --exclude-dir={dist,node_modules,bower_components,.git} -nri --color -B 1 -A 1 '<\{7\} HEAD\|^\=\.{7\}\|>\.{7\}' .; then
  echo 'Fix conflicts'
  exit 1
else ./node_modules/lint-staged/bin/lint-staged.js; fi

Readme

Keywords

none

Package Sidebar

Install

npm i @itcase/lint

Weekly Downloads

124

Version

1.0.16

License

MIT

Unpacked Size

19.1 kB

Total Files

9

Last publish

Collaborators

  • arkadiy_zamaraev