Skip to content

Instantly share code, notes, and snippets.

@noopnik
Last active May 31, 2017 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noopnik/9d2cf18195fd0aa87c65590a92495b65 to your computer and use it in GitHub Desktop.
Save noopnik/9d2cf18195fd0aa87c65590a92495b65 to your computer and use it in GitHub Desktop.
Webstrom + Eslint + Prettier Globals
{
"extends": [
"airbnb",
"prettier"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"impliedStrict": false
}
},
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true
},
"root":true,
"plugins":[
"prettier"
],
"rules": {
"no-param-reassign": ["error", { "props": false }],
"strict": ["error", "global"],
"max-len": ["error", 120, { "ignoreTrailingComments": true }],
"global-require": 0,
"import/no-dynamic-require": 0,
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}],
"no-underscore-dangle": 0,
"quotes": ["error", "single"]
}
}

Need install global eslint, babel-eslint, eslint-plugin-prettier, eslint-config-prettier and instructions in https://www.npmjs.com/package/eslint-config-airbnb . Standart keymap is Default for XWin .

In the settings, select Preferences/Tools/External Tools -> Then all by default options (see https://blog.jetbrains.com/webstorm/2016/08/using-external-tools/). Then Tools Settings:

  • Program: eslint
  • Parameters: --fix $FilePathRelativeToProjectRoot$ --config /home/username/.config/eslint/.eslintrc
  • Working directory: $ProjectFileDir$

For Prettier external tools options:

  • Program: prettier
  • Parameters: --write --single-quote -trailling-comma=es5 --print-width=120 $FilePathRelativeToProject$
  • Working directory: $ProjectFileDir$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment