@lightech-llc/eslint-config-angular

1.0.4 • Public • Published

Installation and setup

  • Run the command:
yarn add -D @lightech-llc/eslint-config-angular
yarn add -D @commitlint/config-conventional
yarn add -D husky

husky install

husky instal command will add directory .husky, create there 2 files:

cd .husky/
husky add pre-commit
husky add commit-msg
  1. pre-commit:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
  1. commit-msg:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
  • Add tsconfig.eslint.json file:
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "rootDir": ".",
    "baseUrl": ".",
    "strict": false,
    "incremental": true
  },
  "include": ["src", "projects"],
  "exclude": ["**/node_modules", "**/schematics/**", "**/.*/", "*.js"]
}
  • Add .eslintrc.js file:
/**
 * @type {import('eslint').Linter.Config}
 */
module.exports = {
  root: true,
  extends: ['@lightech-llc/eslint-config-angular'],
  ignorePatterns: [
    'e2e',
    'src/**/test.ts',
    'src/**/main.ts',
    'src/**/polyfills.ts',
    '*.js',
    '*.json',
    '*.scss',
    '*.md',
  ],
  parserOptions: {
    ecmaVersion: 2020,
    sourceType: 'module',
    project: [require.resolve('./tsconfig.eslint.json')],
  },
  parser: '@typescript-eslint/parser',
};
  • Add commitlint.config.js file:
module.exports = { extends: ['@commitlint/config-conventional'] };
  • Add .lintstagedrc.js file:
module.exports = {
  '*.{js,ts,html,md,scss,json}': ['npm run lint -- --fix', 'prettier --write', 'git add'],
  '*.scss': ['stylelint --fix', 'git add'],
};
  • Add next scripts to package.json:
"scripts": {
  "lint": "eslint ."
}

Package Sidebar

Install

npm i @lightech-llc/eslint-config-angular

Weekly Downloads

1

Version

1.0.4

License

Apache-2.0

Unpacked Size

18.5 kB

Total Files

13

Last publish

Collaborators

  • antonblits
  • zhmanskiy
  • nikita.kovalev.work
  • thelightech