0.3.39 • Published 8 months ago

@dvukovic/style-guide v0.3.39

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

Style Guide

Getting Started

To get the kitchen sink install the required dependencies:

yarn add -D eslint@8.57.0 prettier cspell stylelint npm-package-json-lint @dvukovic/style-guide

add the following scripts

{
    "scripts": {
        "lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:stylelint && yarn lint:spell && yarn lint:package-json",
        "lint:eslint": "eslint . --cache",
        "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write  && yarn lint:stylelint --fix && yarn lint:spell && yarn lint:package-json",
        "lint:package-json": "npmPkgJsonLint --configFile ./.packagerc.js .",
        "lint:prettier": "prettier --log-level=warn --check --cache .",
        "lint:spell": "cspell --config ./.cspellrc.js --no-progress --no-summary --unique '**'",
        "lint:stylelint": "stylelint ./**/*.css --cache"
    }
}

add the following to .gitignore

.eslintcache
.stylelintcache

ESLint

Create a .eslintrc.js in root with the following:

/** @type {import("@types/eslint").ESLint.ConfigData} */
module.exports = {
    root: true,
    extends: [
        // JS/TS
        require.resolve("@dvukovic/style-guide/src/eslint/configs/core"),
        require.resolve("@dvukovic/style-guide/src/eslint/configs/node"),

        // Libraries
        require.resolve("@dvukovic/style-guide/src/eslint/configs/next"),
        require.resolve("@dvukovic/style-guide/src/eslint/configs/mobx"),
        require.resolve("@dvukovic/style-guide/src/eslint/configs/react"),
    ],
    parser: "@typescript-eslint/parser",
    parserOptions: {
        ecmaVersion: 2024,
        project: "./tsconfig.json",
    },
    overrides: [
        {
            files: ["*.ts", "*.tsx"],
            extends: [
                require.resolve(
                    "@dvukovic/style-guide/src/eslint/configs/typescript",
                ),
            ],
        },
        {
            files: ["*.test.ts"],
            extends: [
                require.resolve(
                    "@dvukovic/style-guide/src/eslint/configs/jest",
                ),
            ],
        },
    ],
}

If you need graphql config, everything has to be configured trough overrides

/** @type {import("@types/eslint").ESLint.ConfigData} */
module.exports = {
    ignorePatterns: ["node_modules"],
    overrides: [
        {
            extends: [
                "./src/eslint/configs/core.js",
                "./src/eslint/configs/node.js",
                "./src/eslint/configs/mobx.js",
                "./src/eslint/configs/react.js",
                "./src/eslint/configs/next.js",
            ],
            files: ["*.js", ".ts", ".*.cjs", "*.tsx"],
        },
        {
            extends: ["./src/eslint/configs/typescript.js"],
            files: ["*.ts", "*.tsx"],
        },
        {
            extends: ["./src/eslint/configs/jest.js"],
            files: ["*.test.ts", "*.test.js"],
        },
        {
            extends: ["./src/graphql/configs/core.js"],
            files: ["*.graphql"],
            parser: "@graphql-eslint/eslint-plugin",
            parserOptions: {
                project: "./tsconfig.json",
                schema: "./**/*.graphql",
            },
        },
    ],
    parser: "@typescript-eslint/parser",
    parserOptions: {
        ecmaVersion: 2024,
        project: "./tsconfig.json",
    },
    root: true,
}

Prettier

Create a .prettierrc.js in root with the following:

/** @type {import("prettier").Config} */
module.exports = {
    ...require("@dvukovic/style-guide/src/prettier/configs/core"),
}

Stylelint

Create a .stylelintrc.js in root with the following:

/** @type {import("stylelint").Config} */
module.exports = {
    extends: "@dvukovic/style-guide/src/stylelint/configs/core",
}

CSpell

Create a .cspellrc.js in root with the following:

/** @type {import("cspell").FileSettings} */
module.exports = {
    cache: {
        cacheLocation: "./node_modules/.cache/cspell",
        useCache: true,
    },
    caseSensitive: false,
    dictionaries: ["shared"],
    dictionaryDefinitions: [
        {
            name: "shared",
            path: "./node_modules/@dvukovic/style-guide/src/cspell/base.txt",
        },
    ],
    useGitignore: true,
}

Package Json Lint

Create a .packagerc.js in root with the following:

/** @type {import("npm-package-json-lint").NpmPackageJsonLint} */
module.exports = {
    extends: "@dvukovic/style-guide/src/package-json/configs/core",
}
0.3.39

8 months ago

0.3.38

9 months ago

0.3.37

10 months ago

0.3.36

10 months ago

0.3.35

10 months ago

0.3.34

10 months ago

0.3.33

11 months ago

0.3.32

11 months ago

0.3.31

11 months ago

0.3.30

11 months ago

0.3.29

11 months ago

0.3.28

11 months ago

0.3.27

11 months ago

0.3.26

11 months ago

0.3.25

11 months ago

0.3.24

11 months ago

0.3.23

11 months ago

0.3.22

11 months ago

0.3.21

11 months ago

0.3.20

11 months ago

0.3.19

11 months ago

0.3.18

11 months ago

0.3.17

11 months ago

0.3.16

12 months ago

0.3.15

12 months ago

0.3.14

12 months ago

0.3.13

12 months ago

0.3.12

12 months ago

0.3.11

12 months ago

0.3.10

12 months ago

0.3.9

12 months ago

0.3.8

12 months ago

0.3.7

12 months ago

0.3.6

12 months ago

0.3.5

12 months ago

0.3.4

12 months ago

0.3.3

12 months ago

0.3.2

12 months ago

0.3.1

12 months ago

0.3.0

12 months ago

0.2.0

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago