1.1.0 • Published 1 year ago

eslint-plugin-lintfix v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

lintfix

Install & usage

npm i eslint-plugin-lintfix -D

add prefix "lintfix" to the rulename in eslintrc:

{
  "plugins": ["lintfix"],
  "rules": {
    "lintfix/jsx-a11y": ["error", { label: "my-label" }],
    "lintfix/boundary-types": ["error", { includeAny: false }],
    "lintfix/maxlen": ["error", { code: 180 }],
    "lintfix/console": "error",
    "no-console": ["error", { allow: ["error", "warn", "debug"]}] // allow error and warn 
  }
}
npx eslint . --fix

Supported rules

NameDescription
lintfix/eqeqeqrequire the use of === and !==
lintfix/ts-ignoreDisallow @ts- comments or require descriptions after directives.
lintfix/no-unescapedDisallow unnecessary escape characters.
lintfix/boundary-typesRequire explicit return and argument types on exported functions' and classes' public class methods.
lintfix/implicit-anyThe any type in TypeScript is a dangerous "escape hatch" from the type system.
lintfix/no-unused-importsVerifies that all named imports are part of the set of named exports in the referenced module.
lintfix/no-unused-varsDisallow unused variables.
lintfix/consoleDisallow the use of some console functions.
lintfix/maxlenEnforce a maximum line length.
lintfix/prefer-constRequire const declarations for variables that are never reassigned after declared.
lintfix/jsx-a11yEnforce onClick is accompanied by at least one of the following: onKeyUp, onKeyDown, onKeyPress.
lintfix/jsx-a11yEnforce that a label tag has a text label and an associated control.
lintfix/reactDisplayName allows you to name your component. This name is used by React in debugging messages.
lintfix/no-duplicate-propsCreating JSX elements with duplicate props can cause unexpected behavior in your application.

Recommend Settings

module.exports = {
  plugins: ['@typescript-eslint', 'lintfix'],
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:react/recommended',
    'plugin:jsx-a11y/recommended',
    'plugin:import/recommended'
  ],
  rules: {
    'lintfix/eqeqeq': 'error',
    'lintfix/ts-ignore': 'error',
    'lintfix/no-unescaped': 'error',
    'react/no-unescaped-entities': 'warn', // `'` can be escaped with `'`, `‘`, `'`, `’`  -> lintfix/no-unescaped
    'lintfix/boundary-types': ['error', { includeAny: false }],
    '@typescript-eslint/explicit-module-boundary-types': 'warn', // Argument '...' should be typed with a non-any type -> lintfix/boundary-types
    'lintfix/implicit-any': 'error',
    '@typescript-eslint/no-explicit-any': 'warn', // Unexpected any. Specify a different type -> lintfix/implicit-any
    'lintfix/no-unused-imports': 'error',
    'import/named': 'warn', // ... not found in '...' -> lintfix/no-unused-imports
    'lintfix/no-unused-vars': 'error',
    '@typescript-eslint/no-unused-vars': 'warn', // is defined but never used -> lintfix/no-unused-vars
    'lintfix/console': 'error',
    'no-console': ['error', { allow: ['error', 'warn', 'debug'] }], // Unexpected console statement -> lintfix/console
    'lintfix/maxlen': ['error', { code: 180 }],
    'max-len': 'off', // This line has a length of xxx. Maximum allowed is 80 -> lintfix/maxlen
    'lintfix/prefer-const': 'error',
    'prefer-const': 'off', // '...' is never reassigned. Use 'const' instead -> lintfix/prefer-const'
    'lintfix/jsx-a11y': 'error',
    'jsx-a11y/click-events-have-key-events': 'warn', // Visible, non-interactive elements with click handlers must have at least one keyboard listener -> lintfix/jsx-a11y
    'jsx-a11y/label-has-associated-control': 'warn', // A form label must be associated with a control -> lintfix/jsx-a11y
    'lintfix/react': 'error',
    'react/display-name': 'error', // Component definition is missing display name -> lintfix/react
    'lintfix/no-duplicate-props': 'error',
    'react/jsx-no-duplicate-props': 'warn', // No duplicate props allowed  -> lintfix/no-duplicate-props
1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago