Skip to content

yx1126/front-config

Repository files navigation

@reallyx/front-config

Install

pnpm add @reallyx/front-config -D

Eslint Usage

Config eslint.config.mjs

import { defineEslint } from "@reallyx/front-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 "@reallyx/front-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