From 746ff41cb7043cef9db94b2d5d5dfd48b56aa9b6 Mon Sep 17 00:00:00 2001 From: Pierre-Denis Vanduynslager Date: Sat, 16 Sep 2017 15:40:10 -0400 Subject: [PATCH] style: use `eslint-config-standard` + `prettier` --- .codeclimate.yml | 17 ------------- .eslintrc.js | 4 --- README.md | 2 +- lib/analyze-commit.js | 2 +- lib/default/release-rules.js | 2 +- lib/default/release-types.js | 2 +- lib/index.js | 2 +- lib/load/parser-config.js | 2 +- lib/load/release-rules.js | 4 +-- lib/parse.js | 2 +- package.json | 43 ++++++++++++++++++++++++--------- test/load-parser-config.test.js | 4 +-- 12 files changed, 42 insertions(+), 44 deletions(-) delete mode 100644 .codeclimate.yml delete mode 100644 .eslintrc.js diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 4bb7b637..00000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,17 +0,0 @@ -engines: - eslint: - enabled: true - config: - config: .eslintrc.js - duplication: - enabled: true - exclude_paths: - - test/**/* - config: - languages: - - javascript -ratings: - paths: - - lib/**/*.js - - test/*.js - - test/helpers/*.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 143a364f..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - extends: ['pretty/es6', 'pretty/node', 'pretty/promise', 'pretty/ava', 'pretty/prettier'], - parserOptions: {sourceType: 'module'}, -}; diff --git a/README.md b/README.md index cca86478..6ce37126 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ Customizable commit-analyzer plugin for [semantic-release](https://github.com/se [![npm](https://img.shields.io/npm/dt/sr-commit-analyzer.svg)](https://www.npmjs.com/package/sr-commit-analyzer) [![Greenkeeper badge](https://badges.greenkeeper.io/vanduynslagerp/sr-commit-analyzer.svg)](https://greenkeeper.io/) [![license](https://img.shields.io/github/license/vanduynslagerp/sr-commit-analyzer.svg)](https://github.com/vanduynslagerp/sr-commit-analyzer/blob/master/LICENSE) +[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![Travis](https://img.shields.io/travis/vanduynslagerp/sr-commit-analyzer.svg)](https://travis-ci.org/vanduynslagerp/sr-commit-analyzer) -[![Code Climate](https://img.shields.io/codeclimate/github/vanduynslagerp/sr-commit-analyzer.svg)](https://codeclimate.com/github/vanduynslagerp/sr-commit-analyzer) [![Codecov](https://img.shields.io/codecov/c/github/vanduynslagerp/sr-commit-analyzer.svg)](https://codecov.io/gh/vanduynslagerp/sr-commit-analyzer) ## Install diff --git a/lib/analyze-commit.js b/lib/analyze-commit.js index 48be62fd..53ad966b 100644 --- a/lib/analyze-commit.js +++ b/lib/analyze-commit.js @@ -4,7 +4,7 @@ const compareReleaseTypes = require('./compare-release-types'); /** * Find all the rules matching and return the highest release type of the matching rules. - * + * * @param {Array} releaseRules the rules to match the commit against. * @param {Commit} commit a parsed commit. * @return {string} the highest release type of the matching rules or `undefined` if no rule match the commit. diff --git a/lib/default/release-rules.js b/lib/default/release-rules.js index 3f71b1e7..3862348b 100644 --- a/lib/default/release-rules.js +++ b/lib/default/release-rules.js @@ -1,6 +1,6 @@ /** * Default `releaseRules` rules for common commit formats, following conventions. - * + * * @type {Array} */ module.exports = [ diff --git a/lib/default/release-types.js b/lib/default/release-types.js index 2be542b0..937b01a0 100644 --- a/lib/default/release-types.js +++ b/lib/default/release-types.js @@ -1,6 +1,6 @@ /** * Type of release supported by Semver/NPM. - * + * * @type {Array} */ module.exports = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease']; diff --git a/lib/index.js b/lib/index.js index e4a9a381..4db5d676 100644 --- a/lib/index.js +++ b/lib/index.js @@ -14,7 +14,7 @@ const DEFAULT_RELEASE_RULES = require('./default/release-rules'); /** * Determine the type of release to create based on a list of commits. - * + * * @param {Object} pluginConfig semantic-release configuration * @param {string} pluginConfig.preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint') * @param {string} pluginConfig.config requierable npm package with a custom conventional-changelog preset diff --git a/lib/load/parser-config.js b/lib/load/parser-config.js index af87136c..76294d0e 100644 --- a/lib/load/parser-config.js +++ b/lib/load/parser-config.js @@ -6,7 +6,7 @@ const conventionalChangelogAngular = require('conventional-changelog-angular'); /** * Load `conventional-changelog-parser` options. Handle presets that return either a `Promise` or a `Promise`. - * + * * @param {Object} preset conventional-changelog preset ('angular', 'atom', 'codemirror', 'ember', 'eslint', 'express', 'jquery', 'jscs', 'jshint') * @param {string} config requierable npm package with a custom conventional-changelog preset * @param {Object} parserOpts additionnal `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`. diff --git a/lib/load/release-rules.js b/lib/load/release-rules.js index 4669a09f..af6fbbbb 100644 --- a/lib/load/release-rules.js +++ b/lib/load/release-rules.js @@ -4,10 +4,10 @@ const RELEASE_TYPES = require('../default/release-types'); /** * Load and validate the `releaseRules` rules. - * + * * If `releaseRules` parameter is a `string` then load it as an external module with `require`. * Verifies that the loaded/parameter `releaseRules` is an `Array` and each element has a valid `release` attribute. - * + * * @param {string|Array} releaseRules a string to load an external module or an `Array` of rules. * @return {Array} the loaded and validated `releaseRules`. */ diff --git a/lib/parse.js b/lib/parse.js index 924a96dd..ff94714a 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -3,7 +3,7 @@ const parser = require('conventional-commits-parser').sync; /** * Parse a raw commit. - * + * * @method parse * @param {[type]} rawCommit the raw commit message. * @param {[type]} config the parser configuration. diff --git a/package.json b/package.json index a827a73e..4a8a43b9 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "config": { "commitizen": { - "path": "@metahub/cz-conventional-commit" + "path": "cz-conventional-changelog" } }, "dependencies": { @@ -22,7 +22,6 @@ "devDependencies": { "@commitlint/cli": "^3.1.3", "@commitlint/config-angular": "^3.1.1", - "@metahub/cz-conventional-commit": "^2.0.0", "ava": "^0.22.0", "codecov": "^2.3.0", "commitizen": "^2.9.6", @@ -31,20 +30,15 @@ "conventional-changelog-eslint": "^0.2.0", "conventional-changelog-express": "^0.2.0", "conventional-changelog-jshint": "^0.2.0", + "cz-conventional-changelog": "^2.0.0", "eslint": "^4.5.0", "eslint-config-prettier": "^2.3.0", - "eslint-config-pretty": "^2.1.1", - "eslint-plugin-ava": "^4.2.1", - "eslint-plugin-babel": "^4.1.2", - "eslint-plugin-eslint-comments": "^1.0.3", + "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "^2.7.0", - "eslint-plugin-jasmine": "^2.8.4", - "eslint-plugin-json": "^1.2.0", "eslint-plugin-node": "^5.1.1", "eslint-plugin-prettier": "^2.2.0", "eslint-plugin-promise": "^3.5.0", - "eslint-plugin-sort-class-members": "^1.2.0", - "eslint-plugin-unicorn": "^2.1.2", + "eslint-plugin-standard": "^3.0.1", "husky": "^0.14.3", "nyc": "^11.1.0", "prettier": "^1.5.3", @@ -56,6 +50,26 @@ "engines": { "node": ">=8" }, + "eslintConfig": { + "extends": [ + "standard", + "prettier" + ], + "plugins": [ + "prettier" + ], + "rules": { + "prettier/prettier": [ + 2, + { + "printWidth": 120, + "singleQuote": true, + "bracketSpacing": false, + "trailingComma": "es5" + } + ] + } + }, "files": [ "lib" ], @@ -89,6 +103,12 @@ "peerDependencies": { "semantic-release": ">= 4" }, + "prettier": { + "printWidth": 120, + "singleQuote": true, + "bracketSpacing": false, + "trailingComma": "es5" + }, "publishConfig": { "access": "public" }, @@ -110,8 +130,7 @@ "codecov": "codecov", "commitmsg": "commitlint -e", "coverage": "nyc check-coverage", - "lint": "eslint lib test package.json", - "postcheckout": "yarn install || (rimraf && npm install)", + "lint": "eslint lib test", "precommit": "npm run lint", "prepush": "ava -v", "pretest": "npm run clean && npm run lint", diff --git a/test/load-parser-config.test.js b/test/load-parser-config.test.js index 6f7ff707..4667a66a 100644 --- a/test/load-parser-config.test.js +++ b/test/load-parser-config.test.js @@ -4,7 +4,7 @@ import loadParserConfig from './../lib/load/parser-config'; /** * AVA macro to verify that `loadParserConfig` return a parserOpts object. - * + * * @method loadPreset * @param {Object} t AVA assertion library. * @param {[type]} preset the `conventional-changelog` preset to test. @@ -16,7 +16,7 @@ loadPreset.title = (providedTitle, preset) => `${providedTitle} Load "${preset}" /** * AVA macro to verify that `loadParserConfig` return a parserOpts object. - * + * * @method loadPreset * @param {Object} t AVA assertion library. * @param {[type]} config the `conventional-changelog` config to test.