From 4d3d9aa8424179d53f3c3d54741b8b1940cf4cfc Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Sat, 20 Oct 2018 14:59:39 +0200 Subject: [PATCH] Replace onelint with prettier, switch to 2 space indent --- .editorconfig | 12 ++++++++++++ .eslintignore | 2 -- .eslintrc.js | 31 ++++++++++++++----------------- .prettierignore | 1 + .prettierrc | 3 +++ package.json | 4 +++- 6 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 .editorconfig create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e09b844 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org + +root = true + +[*] +end_of_line = lf +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 diff --git a/.eslintignore b/.eslintignore index aa6b8bf..9e2a2b6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,3 @@ testdata -lib/3rdparty -examples node_modules coverage diff --git a/.eslintrc.js b/.eslintrc.js index 4a36ad2..20edcb4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,18 +1,15 @@ -module.exports = { - extends: [ - 'onelint' - ], - rules: { - 'no-const-assign': 2 - }, - env: { - es6: true - }, - parserOptions: { - ecmaVersion: 2017, - ecmaFeatures: { - experimentalObjectRestSpread: true - - } - } +const config = { + extends: ['pretty-standard'] }; + +if (process.stdin.isTTY) { + // Enable plugin-prettier when running in a terminal. Allows us to have + // eslint verify prettier formatting, while not being bothered by it in our + // editors. + config.plugins = config.plugins || []; + config.plugins.push('prettier'); + config.rules = config.rules || {}; + config.rules['prettier/prettier'] = 'error'; +} + +module.exports = config; diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ec6d3cd --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +package.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/package.json b/package.json index e1424df..f27dfa1 100644 --- a/package.json +++ b/package.json @@ -20,10 +20,12 @@ "assetgraph": "5.4.0", "coveralls": "^3.0.0", "eslint": "5.7.0", - "eslint-config-onelint": "4.0.0", + "eslint-config-pretty-standard": "2.0.0", + "eslint-plugin-prettier": "3.0.0", "istanbul": "^0.4.2", "lodash.pluck": "3.1.2", "mocha": "^5.1.0", + "prettier": "1.14.3", "unexpected": "^10.26.0", "urltools": "0.4.1" },