Skip to content

Commit

Permalink
Merge branch 'issue/#1'
Browse files Browse the repository at this point in the history
  • Loading branch information
amatlash committed Feb 12, 2021
2 parents d7ca021 + 3a01b7c commit 144d4c3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amatlash/vite-plugin-stylelint",
"version": "1.1.0",
"version": "1.1.1",
"description": "Vite 2 plugin to lint CSS with stylelint.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import type { Options } from './utils';

export default function viteStylelint(options: Options = {}): Plugin {
const filter = createFilter(
options.include,
options.exclude || /node_modules/);
options.include || /.*\.(vue|scss|sass|css|postcss)/,
options.exclude || /node_modules/
);

const outputCollection = createOutputCollection();

Expand All @@ -33,7 +34,10 @@ export default function viteStylelint(options: Options = {}): Plugin {
outputCollection.delete(file);
}
})
// .catch(error => console.error(error))
.catch(error => {
this.warn('It looks like you configured bad include/exclude vite-plugin-stylelint options.');
this.error(error);
})
.finally(() => {
displayOutput(outputCollection);
})
Expand Down
10 changes: 8 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ export function normalizePath(filePath: string): string {
}

export interface Options {
/** A single file, or array of files, to include when linting. */
/**
* A single file, or array of files, to include when linting.
* @default /.*\.(vue|scss|sass|css|postcss)/
*/
include?: string | string[] | RegExp;
/** A single file, or array of files, to exclude when linting. */
/**
* A single file, or array of files, to exclude when linting.
* @default /node_modules/
*/
exclude?: string | string[] | RegExp;
}

Expand Down

0 comments on commit 144d4c3

Please sign in to comment.