Help us understand the problem. What is going on with this article?

最近のeslint/prettier周りの設定

More than 1 year has passed since last update.

環境

  • VSCode
  • Javascript

vueを使うことを前提としてます。
vueを使わなくても、eslint/prettier周りの設定なので入れておいて損は無いと覆います。

近々typescriptも入れるつもりです

/.package.json

npm i -D eslint eslint-config-prettier eslint-plugin-prettier eslint-plugin-vue prettier

結果

{
  "devDependencies": {
    "eslint": "^6.1.0",
    "eslint-config-prettier": "^6.0.0",
    "eslint-plugin-prettier": "^3.1.0",
    "eslint-plugin-vue": "^5.2.3",
    "prettier": "^1.18.2",
 },
}

/.prettierrc

{
  "semi": false,
  "singleQuote": true
}

/.eslintrc.js

module.exports = {
  root: true,
  env: {
    browser: true,
    node: true,
    es6: true
  },
  parserOptions: {
    parser: 'babel-eslint',
  },
  extends: [
    'plugin:prettier/recommended',
    'plugin:vue/recommended',
    'prettier',
  ],
  plugins: [ 'vue', 'prettier'],
  // add your custom rules here
  rules: {
    'no-console': 'off',
    'no-unused-labels': 1,
    'prettier/prettier': [
      'error',
      {
        singleQuote: true,
        trailingComma: 'all',
      },
    ],
    'linebreak-style': 'off',
  },
  parserOptions: {
    sourceType: "module",
  }
}

/.vscode/settings.json

{
  "npm-scripts.showStartNotification": false,
  "eslint.autoFixOnSave": true,
  "prettier.eslintIntegration": true,
  "eslint.validate": [
    "javascript",
    {
      "language": "vue",
      "autoFix": true
    }
  ]
}

eslint/prettierがない環境にはもう戻れない

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした