2.2.0 • Published 10 months ago

@bernankez/eslint-config v2.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

@bernankez/eslint-config

npm

!IMPORTANT This repository was originally forked from @antfu/eslint-config, but may not be kept up to date with the latest changes and will eventually evolve into my own version. Some rules were modified to fit my own preferences.

Changes in this fork

  • Double quotes, with semi
  • Brace style: 1tbs
  • Curly: all
  • HTML self closing: <div></div> <img /> <MyComponent />
  • React support becomes built-in and auto-detected
  • Requires ESLint v9.5.0+

Usage

To set up your project, or migrate from the legacy config to the new flat config

npx @bernankez/eslint-config@latest

Install

pnpm install -D eslint @bernankez/eslint-config

#for better output
pnpm install -D eslint-formatter-mo

Create config file

// eslint.config.mjs
import bernankez from "@bernankez/eslint-config";

export default bernankez();

Combined with legacy config:

// eslint.config.js
const bernankez = require("@bernankez/eslint-config").default;
const { FlatCompat } = require("@eslint/eslintrc");

const compat = new FlatCompat();

module.exports = bernankez(
  {
    ignores: [],
  },

  // Legacy config
  ...compat.config({
    extends: [
      "eslint:recommended",
      // Other extends...
    ],
  })

  // Other flat configs...
);

Note that .eslintignore no longer works in Flat config, see customization for more details.

Add script for package.json

For example:

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

VS Code support (auto fix)

Install VS Code ESLint extension

Add the following settings to your .vscode/settings.json:

{
  // Disable the default formatter, use eslint instead
  "prettier.enable": false,
  "editor.formatOnSave": false,

  // Auto fix
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },

  // Silent the stylistic rules in you IDE, but still auto fix them
  "eslint.rules.customizations": [
    { "rule": "style/*", "severity": "off", "fixable": true },
    { "rule": "*-indent", "severity": "off", "fixable": true },
    { "rule": "*-spacing", "severity": "off", "fixable": true },
    { "rule": "*-spaces", "severity": "off", "fixable": true },
    { "rule": "*-order", "severity": "off", "fixable": true },
    { "rule": "*-dangle", "severity": "off", "fixable": true },
    { "rule": "*-newline", "severity": "off", "fixable": true },
    { "rule": "*quotes", "severity": "off", "fixable": true },
    { "rule": "*semi", "severity": "off", "fixable": true }
  ],

  // Enable eslint for all supported languages
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "markdown",
    "json",
    "jsonc",
    "yaml",
    "toml",
    "xml",
    "gql",
    "graphql",
    "astro",
    "css",
    "less",
    "scss",
    "pcss",
    "postcss"
  ]
}

For detailed configurations, please refer to @antfu/eslint-config.

License

MIT License © 2022-PRESENT 科科Cole

2.2.0

10 months ago

2.0.0

11 months ago

2.1.0

10 months ago

1.8.0

11 months ago

1.6.1

12 months ago

1.6.0

12 months ago

1.4.1

12 months ago

1.7.1

11 months ago

1.7.0

11 months ago

1.5.2

12 months ago

1.5.1

12 months ago

1.5.0

12 months ago

1.4.0

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.2.3

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.2

1 year ago

1.2.0

1 year ago

1.2.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0-beta.5

1 year ago

1.0.0-beta.4

1 year ago

1.0.0-beta.2

1 year ago

1.0.0-beta.3

1 year ago

1.0.0-beta.1

1 year ago

0.7.1

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.6.2

2 years ago

0.5.0

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.4.3

2 years ago

0.3.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.2

2 years ago

0.2.2

2 years ago

0.1.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago