Skip to content

Commit

Permalink
Add support for --include option
Browse files Browse the repository at this point in the history
  • Loading branch information
monosans committed Apr 12, 2023
1 parent 1e401f7 commit 222ff0a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 50 deletions.
100 changes: 50 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@
},
"description": "Codes to ignore. Leave blank to get them from the djLint config file."
},
"djlint.include": {
"type": "array",
"items": {
"type": "string"
},
"description": "Codes to include. Leave blank to get them from the djLint config file. Requires djLint>=1.20.0."
},
"djlint.preserveBlankLines": {
"type": "boolean",
"default": false,
Expand Down
1 change: 1 addition & 0 deletions src/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const versionedOptions = [
["include", "include", "1.20.0"],
["configuration", "configuration", "1.13.0"],
["format-css", "formatCss", "1.9.0"],
["format-js", "formatJs", "1.9.0"],
Expand Down
5 changes: 5 additions & 0 deletions src/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ function getLintArgs(
args.push("--ignore", ignore.join(","));
}

const include = config.get<string[]>("include");
if (include !== undefined && include.length !== 0) {
args.push("--include", include.join(","));
}

return args;
}

Expand Down

0 comments on commit 222ff0a

Please sign in to comment.