eslint-config-kifor

1.1.0 • Public • Published

eslint-config-kifor

npm version Build Status Downloads per month

Installation

ℹ️ eslint dependencies are included, so you can remove all eslint related dependencies from your project.

npm install eslint eslint-config-kifor--save-dev

or

yarn add eslint eslint-config-kifor --dev

Configure ESLint

Within your ESLint config file:

// .eslintrc.js file
module.exports = {
  root: true,
  ignorePatterns: ['*.js'],
  overrides: [
    {
      files: ['*.ts'],
      parserOptions: {
        ecmaVersion: 2020,
        sourceType: 'module',
        project: ['tsconfig.json'],
        createDefaultProgram: true,
      },
      extends: ['kifor/typescript', 'kifor/angular-typescript'],
    },
    {
      files: ['*.spec.ts', '*.host.ts', '*.po.ts'],
      env: { jasmine: true /* or 'jest/globals': true,*/ },
      extends: ['kifor/tests', 'kifor/tests-jasmine' /* or 'kifor/tests-jest' */],
    },
    {
      files: ['*.html'],
      extends: ['kifor/angular-template'],
    },
  ],
};
// .eslintrc.json file
{
  "root": true,
  "ignorePatterns": ["*.js"],
  "overrides": [
    {
      "files": ["*.ts"],
      "parserOptions": {
        "ecmaVersion": 2020,
        "sourceType": "module",
        "project": ["tsconfig.json"],
        "createDefaultProgram": true
      },
      "extends": ["kifor/typescript", "kifor/angular-typescript"]
    },
    {
      "files": ["*.spec.ts", "*.host.ts", "*.po.ts"],
      "env": { "jest/globals": true },
      "extends": ["kifor/tests", "kifor/tests-jest"]
    },
    {
      "files": ["*.html"],
      "extends": ["kifor/angular-template"],
      "rules": {}
    }
  ]
}

Tsconfig

For better consistency, please add this options to your tsconfig.json:

{
  "compilerOptions": {
    (...),
    "forceConsistentCasingInFileNames": true, // Ensure that casing is correct in imports
    "noImplicitAny": true, // Enable error reporting for expressions and declarations with an implied any type
    "noImplicitOverride": true, // Ensure overriding members in derived classes are marked with an override modifier
    "strict": true // Enable all strict type checking options
  },
  "angularCompilerOptions": {
    "strictInjectionParameters": true, // Reports an error for a supplied parameter whose injection type cannot be determined
    "strictInputAccessModifiers": true, // Whether access modifiers such as private/protected/readonly are honored when assigning a binding expression to an @Input()
    "strictTemplates": true // Enables strict template type checking
  }
}

Extends

Package Sidebar

Install

npm i eslint-config-kifor

Weekly Downloads

77

Version

1.1.0

License

MIT

Unpacked Size

16.1 kB

Total Files

9

Last publish

Collaborators

  • kiforks