Skip to content

ekil1100/eslint-config-like

Repository files navigation

eslint-config-like

Personal eslint config. Supports typeScript, react, vue, next.js.

Usage

pnpm add -D eslint eslint-config-like

Basic

module.exports = {
  extends: ['like'],
}

with typescript

module.exports = {
  extends: ['like/ts'],
}

React

module.exports = {
  extends: ['like/react'],
}

with typescript

module.exports = {
  extends: ['like/react-ts'],
}

with next.js

module.exports = {
  extends: ['like/react', 'like/next'],
}

Vue

Default to vue3.

module.exports = {
  extends: ['like/vue'],
}

with typescript

module.exports = {
  extends: ['like/vue-ts'],
}

Tips

VSCode Settings

{
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "json",
    "jsonc",
    "json5",
    "yml",
    "yaml"
  ],
  "[javascript][javascriptreact][typescript][typescriptreact]": {
    "editor.formatOnSave": false,
    "editor.formatOnPaste": false,
    "editor.formatOnType": false,
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true
    }
  }
}

Babel parser

Sometimes, you may need add babel as parser for new language features. See babel-eslint-parser for more information.

module.exports = {
  parser: '@babel/eslint-parser',
}

Typescript path resolver

To enable typescript path resolvers in .js files, you can add settings:

module.exports = {
  settings: {
    'import/resolver': {
      typescript: {},
    },
  },
}

No need import React from 'react'?

If you are using react 17, you don't need to import React for JSX. See https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#removing-unused-react-imports.

⚠ It is default after v4.