wiki.rogs.me

my personal wiki

User Tools

Site Tools


Sidebar

dotfiles:eslint-prettier

Eslint / Prettier dotfiles

These are the dotfiles for my Javascript styling

Eslint

It bases from the airbnb eslint configuration and prettier.js. I mostly use it to develop with MEAN, so it allows _id and _doc from mongoose. It allows mocha and ignores should, useful for tests purposes. Finally, it ignores importing devDependencies in tests.

You can also check it out on GitHub here

{
  "env": {
    "mocha": true
  },
  "extends": ["airbnb-base", "prettier"],
  "plugins": ["prettier"],
  "rules": {
    "no-underscore-dangle": ["error", { "allow": ["_id", "_doc"] }],
    "no-param-reassign": ["error", { "props": false }],
    "no-unused-vars": [
      "error",
      {
        "varsIgnorePattern": "should"
      }
    ],
    "import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js"]}],
    "prettier/prettier": ["error"]
  }
}

Prettier

Very basic. Just sets the width to 80, enforces single quote and enables the trailing commas, to comply with Airbnb rules

{
  "printWidth": 80,
  "singleQuote": true,
  "trailingComma": "es5"
}

You can also check it out on GitHub here

dotfiles/eslint-prettier.txt · Last modified: 2019/11/23 23:15 by roger