@josundt/eslint-config

5.7.2 • Public • Published

@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).
  4. Add lint:ts script to your project's package.json file:

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

    npm run lint:ts
  6. 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"
        },
        //...
      ]
      //...
    }
  7. Live Code Analysis in Visual Studio Code:

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.7.23latest

Version History

VersionDownloads (Last 7 Days)Published
5.7.23
5.6.30
5.5.10
5.4.10
5.4.00
5.3.10
5.2.100
5.2.20
5.2.10
5.2.00
5.0.40
4.9.70
4.9.60
4.8.30
4.7.30
4.6.10
4.4.10
4.4.00
4.3.30
4.3.20
4.2.20
4.1.00
4.0.60
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @josundt/eslint-config

Weekly Downloads

2

Version

5.7.2

License

ISC

Unpacked Size

47.2 kB

Total Files

22

Last publish

Collaborators

  • josundt