0.1.5 • Published 2 years ago

eslint-plugin-kriszu v0.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

eslint-plugin-kriszu

English | 中文

ESLint rules for Kriszu.

  • eslint-plugin-kriszu
    • Rules
      • import-dedupe
      • prefer-inline-type-import

Rules

import-dedupe

Fix duplication in imports

The following patterns are considered problems:

import { a, b, a, a, c, a } from 'footer'
// Message: undefined

The following patterns are not considered problems:

import { a, b,   c,  } from 'footer'

prefer-inline-type-import

TypeScript 4.5 introduced type modifiers that allow to inline type imports as opposed to having dedicated import type. This allows to remove duplicate type imports. This rule enforces use of import type modifiers.

The following patterns are considered problems:

import type { foo } from 'bar'
// Message: undefined

import type { foo, baz } from 'bar'
// Message: undefined

The following patterns are not considered problems:

import {type foo} from 'bar'

import type Foo from 'bar'

import type * as Foo from 'bar'

Install

npm add -D eslint eslint-plugin-kriszu

Config .eslintrc

{
  "plugins": ["kriszu"]
}

You don't need .eslintignore normally as it has been provided by the preset.

Add script for package.json

For example:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

This project is based on @antfu/eslint-config

License

MIT License © 2022-PRESENT Krizsu