0.0.24 • Published 4 months ago

@yx1126/lint-config v0.0.24

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@yx1126/lint-config

Install

pnpm add @yx1126/lint-config -D

Eslint Usage

Config eslint.config.mjs

import { defineEslint } from "@yx1126/lint-config";

export default defineEslint({
    // ...configs
});

EslintConfig see configs

Add script for package.json

For example:

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

Stylelint Usage

Config stylelint.config.mjs

import { defineStyleLint } from "@yx1126/lint-config";

export default defineStyleLint({
    // ...configs
});

StylelintConfig see configs

Add script for package.json

For example:

{
    "scripts": {
        "stylelint": "stylelint \"**/*.{css,scss}\"",
        "stylelint:fix": "stylelint \"**/*.{css,scss}\" --fix"
    }
}

VS Code support (auto fix)

Install VS Code ESLint extension

Add the following settings to your settings.json:

{
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": false
    },
    // eslint
    "eslint.format.enable": true,
    "eslint.useFlatConfig": true,
    "eslint.validate": ["vue", "javascript", "javascriptreact", "typescript", "typescriptreact", "jsonc", "json", "json5", "yaml", "yml"],
    // stylelint
    "stylelint.enable": true,
    "stylelint.validate": ["css", "scss", "sass", "vue"]
}

License

MIT License © 2023 Ch Yang