From 8e6d0833d230aedf5242ffd8a7a2289419b57fa2 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 13 Apr 2017 16:34:05 +0000 Subject: [PATCH] chore(package): update prettier to version 1.0.0 https://greenkeeper.io/ Migrated to prettier 1.2.2 Removed code climate support Not supporting all eslint plugins I need. :/ --- .codeclimate.yml | 14 ------ __mocks__/Node.js | 8 +-- __mocks__/Root.js | 12 ++--- package.json | 9 ++-- src/postcss/containerQuery.js | 13 +++-- src/postcss/containerQuery.spec.js | 2 +- src/postcss/isValueUsingContainerUnits.js | 6 ++- src/runtime/adjustContainer.spec.js | 3 +- src/runtime/convertSingleValue.js | 6 ++- src/runtime/getConditionFunction.js | 24 ++++++--- yarn.lock | 60 +++++++++-------------- 11 files changed, 74 insertions(+), 83 deletions(-) delete mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 9f21166..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,14 +0,0 @@ -engines: - csslint: - enabled: false - eslint: - enabled: true - channel: eslint-2 - -ratings: - paths: - - src/**/* - -exclude_paths: - - demo/**/* - - lib/**/* diff --git a/__mocks__/Node.js b/__mocks__/Node.js index c249c4b..9c6a00f 100644 --- a/__mocks__/Node.js +++ b/__mocks__/Node.js @@ -21,7 +21,7 @@ export default class Node { * [parent]: { type: string }, * }} props */ - constructor (props) { + constructor(props) { this.nodes = []; this.selector = props.selector; this.params = props.params; @@ -37,7 +37,7 @@ export default class Node { * * @returns {Node} */ - addNode (node) { + addNode(node) { node.parent = this; this.nodes.push(node); @@ -45,11 +45,11 @@ export default class Node { return this; } - error (message) { + error(message) { throw new Error(message); } - remove () { + remove() { // ... } } diff --git a/__mocks__/Root.js b/__mocks__/Root.js index d434e1a..2d664fe 100644 --- a/__mocks__/Root.js +++ b/__mocks__/Root.js @@ -6,13 +6,13 @@ export default class Root { /** * @param {Object} [source] */ - constructor (source) { - this.type = 'root'; + constructor(source) { + this.type = "root"; this.nodes = []; this.source = { input: { - file: 'non/existent/file/path.css', - }, + file: "non/existent/file/path.css" + } }; } @@ -21,7 +21,7 @@ export default class Root { * * @returns {Node} */ - addNode (node) { + addNode(node) { node.parent = this; this.nodes.push(node); @@ -29,7 +29,7 @@ export default class Root { return this; } - walk (cb) { + walk(cb) { this.nodes.forEach(cb); } } diff --git a/package.json b/package.json index c134acc..168af52 100644 --- a/package.json +++ b/package.json @@ -44,13 +44,13 @@ "babel-polyfill": "^6.23.0", "babel-preset-es2015": "^6.22.0", "coveralls": "^2.11.16", - "eslint": "^3.15.0", - "eslint-config-prettier": "^1.5.0", + "eslint": "^3.19.0", + "eslint-config-prettier": "^1.7.0", "eslint-plugin-prettier": "^2.0.1", "husky": "^0.13.3", "jest": "^19.0.2", "lint-staged": "^3.4.0", - "prettier": "^0.22.0" + "prettier": "^1.2.2" }, "scripts": { "pretest": "yarn run lint", @@ -61,7 +61,8 @@ "watch:test": "jest --watch --notify", "prepublish": "yarn run build", "precommit": "lint-staged", - "eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check" + "eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check", + "prettify": "prettier --write --tab-width=4 '{src|__mocks__}/**/*.js'" }, "lint-staged": { "*.js": [ diff --git a/src/postcss/containerQuery.js b/src/postcss/containerQuery.js index 628cd61..462b991 100644 --- a/src/postcss/containerQuery.js +++ b/src/postcss/containerQuery.js @@ -26,9 +26,11 @@ function addStylesToDefaultQuery( * @param {Node} node */ function shouldProcessNode(node) { - return node.parent.type === "root" || + return ( + node.parent.type === "root" || (node.parent.type === "atrule" && - ["container", "media"].indexOf(node.parent.name) !== -1); + ["container", "media"].indexOf(node.parent.name) !== -1) + ); } /** @@ -88,7 +90,8 @@ function containerQuery(options = {}) { flushCurrentContainerData(newContainer); } - const isContainer = newContainer !== null || + const isContainer = + newContainer !== null || node.selector === currentContainerSelector; if (currentContainerSelector !== null) { @@ -116,8 +119,8 @@ function containerQuery(options = {}) { return; } - const isContainer = elementRule.selector === - currentContainerSelector; + const isContainer = + elementRule.selector === currentContainerSelector; let element = { selector: elementRule.selector, styles: getStylesObjectFromNode( diff --git a/src/postcss/containerQuery.spec.js b/src/postcss/containerQuery.spec.js index 40d4f6f..e5d241f 100644 --- a/src/postcss/containerQuery.spec.js +++ b/src/postcss/containerQuery.spec.js @@ -161,7 +161,7 @@ test("proper json and css output", () => { return postcss([ containerQuery({ - getJSON: (cssPath, json) => containersJSON = json + getJSON: (cssPath, json) => (containersJSON = json) }) ]) .process( diff --git a/src/postcss/isValueUsingContainerUnits.js b/src/postcss/isValueUsingContainerUnits.js index abdcc63..61db92c 100644 --- a/src/postcss/isValueUsingContainerUnits.js +++ b/src/postcss/isValueUsingContainerUnits.js @@ -19,12 +19,14 @@ export default function isValueUsingContainerUnits(value) { const unit = match[3]; - return unit !== HEIGHT_UNIT && + return ( + unit !== HEIGHT_UNIT && unit !== WIDTH_UNIT && unit !== MIN_UNIT && unit !== MAX_UNIT && (unit.indexOf(HEIGHT_UNIT) === 0 || unit.indexOf(WIDTH_UNIT) === 0 || unit.indexOf(MIN_UNIT) === 0 || - unit.indexOf(MAX_UNIT) === 0); + unit.indexOf(MAX_UNIT) === 0) + ); } diff --git a/src/runtime/adjustContainer.spec.js b/src/runtime/adjustContainer.spec.js index c9132b3..e2e5dca 100644 --- a/src/runtime/adjustContainer.spec.js +++ b/src/runtime/adjustContainer.spec.js @@ -164,7 +164,8 @@ describe("query styles should be applied, then removed when conditions no longer }); test("shouldn't adjust if the configuration is null (invalid)", () => { - const getContainerDimensionsMock = require("./getContainerDimensions").default; + const getContainerDimensionsMock = require("./getContainerDimensions") + .default; adjustContainer(container); diff --git a/src/runtime/convertSingleValue.js b/src/runtime/convertSingleValue.js index dd64e27..083b2e8 100644 --- a/src/runtime/convertSingleValue.js +++ b/src/runtime/convertSingleValue.js @@ -56,11 +56,13 @@ export default function convertSingleValue(dimensions, value) { const normalisedUnit = normaliseUnit(unit); - const relativeToHeight = unit.indexOf(HEIGHT_UNIT) === 0 || + const relativeToHeight = + unit.indexOf(HEIGHT_UNIT) === 0 || (unit.indexOf(MIN_UNIT) === 0 && dimensions.height < dimensions.width) || (unit.indexOf(MAX_UNIT) === 0 && dimensions.height > dimensions.width); - const relativeToWidth = unit.indexOf(WIDTH_UNIT) === 0 || + const relativeToWidth = + unit.indexOf(WIDTH_UNIT) === 0 || (unit.indexOf(MIN_UNIT) === 0 && dimensions.height >= dimensions.width) || (unit.indexOf(MAX_UNIT) === 0 && dimensions.height <= dimensions.width); diff --git a/src/runtime/getConditionFunction.js b/src/runtime/getConditionFunction.js index 120b3bb..dbdc948 100644 --- a/src/runtime/getConditionFunction.js +++ b/src/runtime/getConditionFunction.js @@ -92,23 +92,31 @@ function convertConditionArrayToFunction(condition) { } else if (feature === "aspect-ratio") { if (operation === ">") { return containerDimensions => { - return containerDimensions.width / containerDimensions.height > - value; + return ( + containerDimensions.width / containerDimensions.height > + value + ); }; } else if (operation === ">=") { return containerDimensions => { - return containerDimensions.width / containerDimensions.height >= - value; + return ( + containerDimensions.width / containerDimensions.height >= + value + ); }; } else if (operation === "<") { return containerDimensions => { - return containerDimensions.width / containerDimensions.height < - value; + return ( + containerDimensions.width / containerDimensions.height < + value + ); }; } else if (operation === "<=") { return containerDimensions => { - return containerDimensions.width / containerDimensions.height <= - value; + return ( + containerDimensions.width / containerDimensions.height <= + value + ); }; } } else if (feature === "orientation") { diff --git a/yarn.lock b/yarn.lock index 73df785..06bf024 100644 --- a/yarn.lock +++ b/yarn.lock @@ -149,13 +149,9 @@ assert-plus@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" -ast-types@0.8.18: - version "0.8.18" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.8.18.tgz#c8b98574898e8914e9d8de74b947564a9fe929af" - -ast-types@0.9.4: - version "0.9.4" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.4.tgz#410d1f81890aeb8e0a38621558ba5869ae53c91b" +ast-types@0.9.8: + version "0.9.8" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.8.tgz#6cb6a40beba31f49f20928e28439fc14a3dab078" async-each@^1.0.0: version "1.0.1" @@ -632,9 +628,9 @@ babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23 lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@6.15.0: - version "6.15.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" +babylon@7.0.0-beta.8: + version "7.0.0-beta.8" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: version "6.16.1" @@ -828,10 +824,6 @@ color-name@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.2.tgz#5c8ab72b64bd2215d617ae9559ebb148475cf98d" -colors@>=0.6.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" - combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" @@ -1104,9 +1096,9 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-prettier@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-1.5.0.tgz#969b6d21b2eb2574a6810426507f755072db1963" +eslint-config-prettier@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-1.7.0.tgz#cda3ce22df1e852daa9370f1f3446e8b8a02ce44" dependencies: get-stdin "^5.0.1" @@ -1116,9 +1108,9 @@ eslint-plugin-prettier@^2.0.1: dependencies: requireindex "~1.1.0" -eslint@^3.15.0: - version "3.18.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.18.0.tgz#647e985c4ae71502d20ac62c109f66d5104c8a4b" +eslint@^3.19.0: + version "3.19.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc" dependencies: babel-code-frame "^6.16.0" chalk "^1.1.3" @@ -1332,13 +1324,9 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-parser@0.40.0: - version "0.40.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.40.0.tgz#b3444742189093323c4319c4fe9d35391f46bcbc" - dependencies: - ast-types "0.8.18" - colors ">=0.6.2" - minimist ">=0.2.0" +flow-parser@0.43.0: + version "0.43.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.43.0.tgz#e2b8eb1ac83dd53f7b6b04a7c35b6a52c33479b7" for-in@^1.0.1: version "1.0.2" @@ -2073,14 +2061,14 @@ js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" -js-yaml@3.6.1, js-yaml@^3.4.3, js-yaml@^3.5.1: +js-yaml@3.6.1, js-yaml@^3.4.3: version "3.6.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" dependencies: argparse "^1.0.7" esprima "^2.6.0" -js-yaml@^3.7.0: +js-yaml@^3.5.1, js-yaml@^3.7.0: version "3.8.2" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.2.tgz#02d3e2c0f6beab20248d412c352203827d786721" dependencies: @@ -2358,7 +2346,7 @@ minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@1.2.0, minimist@>=0.2.0, minimist@^1.1.1, minimist@^1.2.0: +minimist@1.2.0, minimist@^1.1.1, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -2657,16 +2645,16 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@^0.22.0: - version "0.22.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-0.22.0.tgz#7b37c4480d0858180407e5a8e13f0f47da7385d2" +prettier@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.2.2.tgz#22d17c1132faaaea1f1d4faea31f19f7a1959f3e" dependencies: - ast-types "0.9.4" + ast-types "0.9.8" babel-code-frame "6.22.0" - babylon "6.15.0" + babylon "7.0.0-beta.8" chalk "1.1.3" esutils "2.0.2" - flow-parser "0.40.0" + flow-parser "0.43.0" get-stdin "5.0.1" glob "7.1.1" jest-validate "19.0.0"