Skip to content

Commit

Permalink
Merge 8d0e554 into 9bcb999
Browse files Browse the repository at this point in the history
  • Loading branch information
KamiKillertO committed Sep 16, 2020
2 parents 9bcb999 + 8d0e554 commit c5cb945
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .todo
@@ -1,3 +1,8 @@
## cli

* allow absolute path "linthtml /root/xx/xx/my.html"
* allow realtive path with ".." "linthtml ../my.html"

## refactor

✔️ [0.5.0][inline-config] Remove `preset=`, `${preset}`
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/index.js
Expand Up @@ -108,7 +108,7 @@ async function lint(input, config_path) {
let files_linters = [];
const searchSpinner = ora("Searching for files").start();
try {
files_linters = linthtml.create_linters_for_files(input, config_path);
files_linters = await linthtml.create_linters_for_files(input, config_path);
searchSpinner.succeed(`Found ${files_linters.length} files`); // deal with 0
} catch (error) {
searchSpinner.fail();
Expand Down
9 changes: 6 additions & 3 deletions lib/index.js
Expand Up @@ -54,10 +54,10 @@ function get_files_to_lint(input, config = {}) {
}

function get_files_from_glob(glob_pattern, ignore_config) {
const use_default_ignore = ignore_config === undefined;
return globby.sync(glob_pattern, {
const use_default_ignore = ignore_config === undefined && path.isAbsolute(glob_pattern) === false;

return globby.sync([glob_pattern, ...DEFAULT_EXCLUDED_FOLDERS], {
gitignore: use_default_ignore,
ignore: use_default_ignore ? DEFAULT_EXCLUDED_FOLDERS : [],
expandDirectories: {
files: ["**/*.html"],
extensions: ["html"]
Expand All @@ -82,6 +82,9 @@ function read_dot_ignore_file() {
}

function should_ignore_file(file_path, ignore_pattern) {
if (ignore_pattern === undefined) {
return false;
}
const ignorer = ignore().add(ignore_pattern);
return ignorer.ignores(file_path);
}
Expand Down

0 comments on commit c5cb945

Please sign in to comment.