0.3.20 • Published 1 year ago

@thenic/eslint-config v0.3.20

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

@thenic/eslint-config

CI npm downloads javascript_code style

Features

  • "double quotes", must semi;
  • Auto fix for formatting (aimed to be used standalone without Prettier)
  • TypeScript, Vue out-of-box
  • Lint also for JSON、YAML、Markdown
  • Sorted imports, dangling commas for cleaner commit diff
  • Reasonable defaults, best practices, only one-line of config

Usage

Shareable configs are designed to work with the extends feature of .eslintrc files. You can learn more about Shareable Configs on the official ESLint website.

run the following command:

Install

pnpm add -D eslint @thenic/eslint-config

add this to your .eslintrc file:

{
  "extends": "@thenic"
}

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"
  }
}

Config VS Code auto fix

Create .vscode/settings.json

{
  "prettier.enable": false,
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}

Customization rules

add you like rules to your .eslintrc file:

{
  "extends": [
    "@thenic"
  ],
  "rules": {
    "vue/component-tags-order": ["error", {
      "order": ["template", "script", "style"]
    }]
  }
}

TypeScript Aware Rules

Type aware rules are enabled when a tsconfig.eslint.json is found in the project root. Refer to this file.

Badge

Use this in one of your projects? Include one of these badges in your readme to let people know that your code is using the standard style.

thenic-code-style-image

[![thenic-code-style-image](https://img.shields.io/badge/code__style-%40thenic%2Feslint--config-brightgreen)](https://github.com/NicCraver/eslint-config/)

Thanks

This project is based on @antfu/eslint-config

License

MIT License © 2019-PRESENT Kirk Lin