5.8.0 • Published 8 months ago

@josundt/eslint-config v5.8.0

Weekly downloads
6
License
ISC
Repository
github
Last release
8 months ago

@josundt/eslint-config

ESLint ruleset including required ESLint plugins for josundt TypeScript projects

Usage

  1. Make sure you have installed and configured @josundt/prettier-config first

  2. Install this package

    npm install @josundt/eslint-config
  3. Create an eslint.config.js file in the root directory of your project with approximately the following content:

    import tsBrowserConfig from "@josundt/eslint-config/ts-browser";
    import tsJestBrowserConfig from "@josundt/eslint-config/ts-jest-browser";
    
    // When the project has JEST tests
    const config = [
        {
            ...tsBrowserConfig,
            files: ["src/**/*.ts"]
        },
        {
            ...tsJestBrowserConfig,
            files: ["test/**/?(*.)+(spec).ts?(x)"]
        }
    ];
    
    // Otherwise
    const config = { 
        ...tsBrowserConfig,  
        files: ["src/**/*.ts"]
    };
    
    export default config;

    All configurations:

    • ["@josundt/eslint-config/ts-browser"] (for browser environment code).
    • ["@josundt/eslint-config/ts-node"] (for node environment code).
    • ["@josundt/eslint-config/ts-jest-browser"] (for Jest tests for browser environment code).
    • ["@josundt/eslint-config/ts-jest-node"] (for Jest tests for node environment code).
  1. Add lint:ts script to your project's package.json file:

    {
        // ...
        "scripts": {
            // ...
            "lint:ts": "eslint src test --format visualstudio"
            // ...
        }
        // ...
    }
  2. Test the script:

    npm run lint:ts
  3. Task in Visual Studio Code:

    • Add the following to .vscode/tasks.json:
    {
      //...
      "tasks": [
        //...
        {
          "label": "lint:ts",
          "type": "shell",
          "command": "npx",
          "args": ["eslint", "src", "test", "-f", "stylish"],
          "group": "build",
          "problemMatcher": "$eslint-stylish"
        },
        //...
      ]
      //...
    }
  4. Live Code Analysis in Visual Studio Code:

    • Install extension for VSCode: ESLint (dbaeumer.vscode-eslint)
5.7.3

8 months ago

5.7.2

11 months ago

5.6.3

11 months ago

5.8.0

8 months ago

5.5.1

1 year ago

5.5.0

1 year ago

5.4.1

2 years ago

5.4.0

2 years ago

5.3.1

2 years ago

5.2.10

2 years ago

5.2.2

2 years ago

5.2.1

2 years ago

5.2.0

2 years ago

5.0.4

3 years ago

4.9.7

3 years ago

4.9.6

3 years ago

4.8.3

3 years ago

4.7.3

3 years ago

4.6.1

4 years ago

4.4.1

4 years ago

4.4.0

4 years ago

4.3.3

4 years ago

4.3.2

4 years ago

4.2.2

5 years ago

4.1.0

5 years ago

4.0.6

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago