3.0.2 • Published 5 months ago

@mindevieras/eslint-config-mindevieras v3.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

eslint-config-mindevieras

Shared ESLint configuration for TypeScript projects.

Features

  • Lints TypeScript based on the latest standards.
  • Fixes issues and formatting errors with Prettier.
  • Supports node and browser environments.

Installation

  1. Install the package using npm:

    npm install -D @mindevieras/eslint-config-mindevieras
  2. Create a .eslintrc file in the root directory of your project (where package.json resides). Add the following content to the .eslintrc file:

    {
      "extends": [ "@mindevieras/eslint-config-mindevieras" ],
      // Or:
      "extends": [ "@mindevieras/eslint-config-mindevieras/react" ],
    }
  3. Optionally, you can add scripts to your package.json file for linting and fixing:

    "scripts": {
      "lint": "eslint .",
      "lint:fix": "eslint . --fix"
    }
  4. You can now manually lint your code by running npm run lint and fix fixable issues with npm run lint:fix. However, it's recommended to configure your editor to handle this automatically.

Customization

If you want to override ESLint or Prettier settings, you can add the corresponding rules to your .eslintrc file. For ESLint rules, add them under the "rules" key. You can refer to the ESLint rules documentation for more details.

Example .eslintrc file:

{
  "extends": ["@mindevieras/eslint-config-mindevieras"],
  "rules": {
    "no-console": 2,
  }
}

Editor Setup (VSCode)

  1. Install the ESLint extension for Visual Studio Code.

  2. Open the .vscode/settings.json file in your project and add the following settings:

     {
       "editor.formatOnSave": true,
       "[javascript]": {
         "editor.formatOnSave": false,
       },
       "editor.codeActionsOnSave": {
         "source.fixAll": true
       },
       "editor.autoIndent": "full",
       "editor.insertSpaces": true,
       "editor.formatOnPaste": false,
       "editor.defaultFormatter": "dbaeumer.vscode-eslint",
       "editor.renderWhitespace": "boundary",
       "editor.wordWrap": "off",
       "editor.detectIndentation": true,
       "editor.rulers": [
         120
       ],
       "files.exclude": {
         "**/.git": true,
         "**/.DS_Store": true
       },
     }
  3. Restart Visual Studio Code for the changes to take effect.

Note: The extension Prettier - Code formatter is not required as it is already integrated with the ESLint configuration.