Skip to content

Commit

Permalink
fix(putout) get-relative-path -> path.relative: determine relative pa…
Browse files Browse the repository at this point in the history
…th for ignore and match on windows (#7)
  • Loading branch information
coderaiser committed Aug 8, 2019
1 parent 41381b5 commit a34d32d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 50 deletions.
12 changes: 0 additions & 12 deletions packages/putout/lib/get-relative-path.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/putout/lib/ignores.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

const {relative} = require('path');
const ignore = require('ignore');
const getRelativePath = require('../lib/get-relative-path');

module.exports = (dirOpt, resolvedName, options) => {
const relativeName = getRelativePath(resolvedName, dirOpt);
const relativeName = relative(dirOpt, resolvedName);
const ignorer = ignore();

if (options.ignore)
Expand Down
10 changes: 7 additions & 3 deletions packages/putout/lib/parse-options.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
'use strict';

const {homedir} = require('os');
const {dirname, join} = require('path');
const {
dirname,
join,
relative,
} = require('path');
const {readdirSync} = require('fs');

const findUp = require('find-up');
Expand All @@ -11,9 +15,9 @@ const tryCatch = require('try-catch');
const merge = require('./merge');
const parseMatch = require('./parse-match');
const defaultOptions = require('../putout.json');
const getRelativePath = require('../lib/get-relative-path');

const home = homedir();
const cwd = process.cwd();

const readHomeOptions = once(_readHomeOptions);
const readCodeMods = once(_readCodeMods);
Expand All @@ -24,7 +28,7 @@ module.exports = ({rulesdir, name = '', options = {}} = {}) => {
const homeOptions = readHomeOptions();
const mergedOptions = merge(options, defaultOptions, homeOptions, customOptions);
const {match} = mergedOptions;
const relativeName = getRelativePath(name, dir);
const relativeName = relative(cwd, name);

const resultOptions = merge(
readCodeMods(),
Expand Down
33 changes: 0 additions & 33 deletions packages/putout/test/get-relative-path.js

This file was deleted.

0 comments on commit a34d32d

Please sign in to comment.