@nextgis/eslint-config

3.0.0-alpha.5 • Public • Published

NextGIS config for Eslint

A Typescript and Javascript configuration for ESLint used in NextGIS frontend projects.

Install

All dependencies are already included in this library so you can not install them separately. Just run the command:

npm i -D @nextgis/eslint-config

Then create the .eslintrc in the root of your project and add the following content:

{
  "extends": [
    "@nextgis/eslint-config"
  ]
}

Webpack

Install eslint loader for webpack

npm i -D eslint-loader

In your webpack configuration

module.exports = {
  // ...
  module: {
    rules: [
      {
        enforce: "pre",
        test: /\.(t|j)sx?$/,
        loader: "eslint-loader",
        exclude: /node_modules/
      },
      {
        test: /\.js$/,
        loader: "babel-loader",
        exclude: /node_modules/
      },
      {
        test: /\.tsx?$/,
        loader: 'ts-loader',
        exclude: /node_modules/
      },
    ]
  }
  // ...
};

VSCode

To properly set up the environment for checking and automatically fixes *.ts files, follow these steps:

  • Install VSCode ESLint extension from site or from plugin manager;

  • Configure project to work with typescript files

Open VSCode File > Preferences > Settings JSON view

Or create config file manual:

mkdir .vscode && touch .vscode/settings.json

and add this to config:

  "editor.formatOnSave": true,
  "eslint.autoFixOnSave": true,
  "eslint.validate": [
    {
      "language": "javascript",
      "autoFix": true
    },
    {
      "language": "javascriptreact",
      "autoFix": true
    },
    {
      "language": "typescript",
      "autoFix": true
    },
    {
      "language": "typescriptreact",
      "autoFix": true
    }
  ],
  "tslint.enable": false

Dependencies (7)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @nextgis/eslint-config

    Weekly Downloads

    84

    Version

    3.0.0-alpha.5

    License

    MIT

    Unpacked Size

    20 kB

    Total Files

    5

    Last publish

    Collaborators

    • rendrom
    • maximdubinin
    • karavanjo