Skip to content

fix(core): default to process.cwd #100 #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions @commitlint/core/fixtures/basic/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
rules: {
basic: true
}
};
2 changes: 1 addition & 1 deletion @commitlint/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "npx rimraf lib",
"pretest": "dep-check",
"start": "npx concurrently \"npx ava -c 4 --verbose --watch\" \"npx yarn run watch\"",
"test": "npx ava -c 4 --verbose",
"test": "npx ava -c 4 --verbose && npx ava \"src/*.serial-test.js\" --verbose",
"watch": "npx babel src --out-dir lib --watch --source-maps"
},
"ava": {
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/core/src/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import resolveExtends from './library/resolve-extends';
const w = (a, b) => (Array.isArray(b) ? b : undefined);
const valid = input => pick(input, 'extends', 'rules', 'parserPreset');

export default async (seed = {}, options = {cwd: ''}) => {
export default async (seed = {}, options = {cwd: process.cwd()}) => {
const loaded = await loadConfig(options.cwd);
const base = loaded.filepath ? path.dirname(loaded.filepath) : options.cwd;

Expand Down
19 changes: 19 additions & 0 deletions @commitlint/core/src/load.serial-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {fix} from '@commitlint/test';
import test from 'ava';

import load from './load';

test.serial('default cwd option to process.cwd()', async t => {
const cwd = await fix.bootstrap('fixtures/basic');
const before = process.cwd();
process.chdir(cwd);

try {
const actual = await load();
t.true(actual.rules.basic);
} catch (err) {
throw err;
} finally {
process.chdir(before);
}
});
83 changes: 5 additions & 78 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1951,13 +1951,6 @@ cp-file@^4.1.1:
pify "^2.3.0"
safe-buffer "^5.0.1"

create-error-class@^2.0.0:
version "2.0.1"
resolved "https://registry.npmjs.org/create-error-class/-/create-error-class-2.0.1.tgz#a8759ed5c8d214a461e81d18e70aacb33dd63c9c"
dependencies:
capture-stack-trace "^1.0.0"
inherits "^2.0.1"

create-error-class@^3.0.0, create-error-class@^3.0.1:
version "3.0.2"
resolved "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6"
Expand Down Expand Up @@ -2311,7 +2304,7 @@ duplexer@^0.1.1:
version "0.1.1"
resolved "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"

duplexify@^3.1.2, duplexify@^3.2.0, duplexify@^3.4.2:
duplexify@^3.1.2, duplexify@^3.4.2:
version "3.5.1"
resolved "https://registry.npmjs.org/duplexify/-/duplexify-3.5.1.tgz#4e1516be68838bc90a49994f0b39a6e5960befcd"
dependencies:
Expand Down Expand Up @@ -2706,7 +2699,7 @@ event-emitter@~0.3.5:
d "1"
es5-ext "~0.10.14"

[email protected], execa@^0.6.0:
[email protected]:
version "0.6.3"
resolved "https://registry.npmjs.org/execa/-/execa-0.6.3.tgz#57b69a594f081759c69e5370f0d17b9cb11658fe"
dependencies:
Expand Down Expand Up @@ -3338,25 +3331,6 @@ good-listener@^1.2.2:
dependencies:
delegate "^3.1.2"

got@^4.2.0:
version "4.2.0"
resolved "https://registry.npmjs.org/got/-/got-4.2.0.tgz#af59f461834bfafd722cba01acf4c14a9dd5da06"
dependencies:
create-error-class "^2.0.0"
duplexify "^3.2.0"
is-plain-obj "^1.0.0"
is-redirect "^1.0.0"
is-stream "^1.0.0"
lowercase-keys "^1.0.0"
node-status-codes "^1.0.0"
object-assign "^3.0.0"
parse-json "^2.1.0"
pinkie-promise "^1.0.0"
prepend-http "^1.0.0"
read-all-stream "^3.0.0"
timed-out "^2.0.0"
unzip-response "^1.0.0"

got@^5.0.0:
version "5.7.1"
resolved "https://registry.npmjs.org/got/-/got-5.7.1.tgz#5f81635a61e4a6589f180569ea4e381680a51f35"
Expand Down Expand Up @@ -4537,7 +4511,7 @@ lodash.isequal@^4.4.0, lodash.isequal@^4.5.0:
version "4.5.0"
resolved "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"

lodash.kebabcase@^4.0.1, lodash.kebabcase@^4.1.1:
lodash.kebabcase@^4.0.1:
version "4.1.1"
resolved "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"

Expand Down Expand Up @@ -5201,10 +5175,6 @@ obj-props@^1.0.0:
version "1.1.0"
resolved "https://registry.npmjs.org/obj-props/-/obj-props-1.1.0.tgz#626313faa442befd4a44e9a02c3cb6bde937b511"

object-assign@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2"

object-assign@^4.0.1, object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
Expand Down Expand Up @@ -5364,10 +5334,6 @@ p-map@^1.1.1:
version "1.2.0"
resolved "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b"

p-tap@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/p-tap/-/p-tap-1.0.0.tgz#dc4fa086135e8688226f6e7dccea67d8322d08df"

package-hash@^1.2.0:
version "1.2.0"
resolved "https://registry.npmjs.org/package-hash/-/package-hash-1.2.0.tgz#003e56cd57b736a6ed6114cc2b81542672770e44"
Expand Down Expand Up @@ -5617,7 +5583,7 @@ prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"

prepend-http@^1.0.0, prepend-http@^1.0.1:
prepend-http@^1.0.1:
version "1.0.4"
resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"

Expand Down Expand Up @@ -6481,13 +6447,6 @@ ssri@^4.1.2, ssri@^4.1.6, ssri@~4.1.6:
dependencies:
safe-buffer "^5.1.0"

stable-node-version@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/stable-node-version/-/stable-node-version-1.0.0.tgz#15be1d6185fdab456815595fd8f90ef30307c5b2"
dependencies:
got "^4.2.0"
semver "^5.0.3"

stack-utils@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz#d4f33ab54e8e38778b0ca5cfd3b3afb12db68620"
Expand Down Expand Up @@ -6799,10 +6758,6 @@ time-zone@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz#99c5bf55958966af6d06d83bdf3800dc82faec5d"

timed-out@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/timed-out/-/timed-out-2.0.0.tgz#f38b0ae81d3747d628001f41dafc652ace671c0a"

timed-out@^3.0.0:
version "3.1.3"
resolved "https://registry.npmjs.org/timed-out/-/timed-out-3.1.3.tgz#95860bfcc5c76c277f8f8326fd0f5b2e20eba217"
Expand Down Expand Up @@ -6845,27 +6800,6 @@ tree-kill@^1.1.0:
version "1.2.0"
resolved "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.0.tgz#5846786237b4239014f05db156b643212d4c6f36"

trevor@^2.3.0:
version "2.3.0"
resolved "https://registry.npmjs.org/trevor/-/trevor-2.3.0.tgz#f128b78489fc0b04be58fdc106695577906cda6f"
dependencies:
arrify "^1.0.1"
chalk "^1.1.3"
cp-file "^4.1.1"
execa "^0.6.0"
figures "^2.0.0"
indent-string "^3.1.0"
load-json-file "^2.0.0"
lodash.kebabcase "^4.1.1"
log-update "^1.0.2"
meow "^3.7.0"
p-map "^1.1.1"
p-tap "^1.0.0"
pify "^2.3.0"
stable-node-version "^1.0.0"
text-table "^0.2.0"
yamljs "^0.2.8"

trigram-utils@^0.1.0:
version "0.1.1"
resolved "https://registry.npmjs.org/trigram-utils/-/trigram-utils-0.1.1.tgz#7df8a092c9897fc2e09dac22f423e283231762e7"
Expand Down Expand Up @@ -6979,7 +6913,7 @@ unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"

unzip-response@^1.0.0, unzip-response@^1.0.2:
unzip-response@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz#b984f0877fc0a89c2c773cc1ef7b5b232b5b06fe"

Expand Down Expand Up @@ -7311,13 +7245,6 @@ yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"

yamljs@^0.2.8:
version "0.2.10"
resolved "https://registry.npmjs.org/yamljs/-/yamljs-0.2.10.tgz#481cc7c25ca73af59f591f0c96e3ce56c757a40f"
dependencies:
argparse "^1.0.7"
glob "^7.0.5"

yargonaut@^1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/yargonaut/-/yargonaut-1.1.2.tgz#ee7b89e98121a3f241fa926a2a6e1b6641c81b3f"
Expand Down