Skip to content
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

feat: support stylelint 14 #250

Merged
merged 2 commits into from
Nov 1, 2021
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
8 changes: 6 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
- name: Lint
run: npm run lint

#- name: Security audit
# run: npm run security
- name: Security audit
run: npm run security

- name: Check commit message
uses: wagoid/commitlint-github-action@v4
Expand All @@ -56,6 +56,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12.x, 14.x, 16.x]
stylelint-version: [13.x, 14.x]
webpack-version: [latest]

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -87,6 +88,9 @@ jobs:
- name: Install webpack ${{ matrix.webpack-version }}
run: npm i webpack@${{ matrix.webpack-version }}

- name: Install stylelint ${{ matrix.stylelint-version }}
run: npm i stylelint@${{ matrix.stylelint-version }}

- name: Run tests for webpack version ${{ matrix.webpack-version }}
run: npm run test:coverage -- --ci

Expand Down
50 changes: 49 additions & 1 deletion declarations/getStylelint.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="stylelint" />
/**
* @param {string|undefined} key
* @param {Options} options
Expand All @@ -7,7 +8,54 @@ export default function getStylelint(
key: string | undefined,
{ threads, ...options }: Options
): Linter;
export type Stylelint = typeof import('stylelint');
export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
import('stylelint').PostcssPluginOptions
> & {
lint: (
options: import('stylelint').LinterOptions
) => Promise<import('stylelint').LinterResult>;
rules: {
[k: string]: import('stylelint').Rule<any, any>;
};
formatters: {
[k: string]: import('stylelint').Formatter;
};
createPlugin: (
ruleName: string,
plugin: import('stylelint').Plugin<any, any>
) => {
ruleName: string;
rule: import('stylelint').Rule<any, any>;
};
createLinter: (
options: import('stylelint').LinterOptions
) => import('stylelint').InternalApi;
utils: {
report: (problem: import('stylelint').Problem) => void;
ruleMessages: <
T extends import('stylelint').RuleMessages,
R extends { [K in keyof T]: T[K] }
>(
ruleName: string,
messages: T
) => R;
validateOptions: (
result: import('stylelint').PostcssResult,
ruleName: string,
...optionDescriptions: import('stylelint').RuleOptions[]
) => boolean;
checkAgainstRule: <T_1, O extends Object>(
options: {
ruleName: string;
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
root: import('stylelint/node_modules/postcss').Root;
},
callback: (
warning: import('stylelint/node_modules/postcss').Warning
) => void
) => void;
};
};
export type LintResult = import('stylelint').LintResult;
export type Options = import('./options').Options;
export type AsyncTask = () => Promise<void>;
Expand Down
50 changes: 49 additions & 1 deletion declarations/linter.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="stylelint" />
/**
* @param {string|undefined} key
* @param {Options} options
Expand All @@ -13,7 +14,54 @@ export default function linter(
report: Reporter;
threads: number;
};
export type Stylelint = typeof import('stylelint');
export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
import('stylelint').PostcssPluginOptions
> & {
lint: (
options: import('stylelint').LinterOptions
) => Promise<import('stylelint').LinterResult>;
rules: {
[k: string]: import('stylelint').Rule<any, any>;
};
formatters: {
[k: string]: import('stylelint').Formatter;
};
createPlugin: (
ruleName: string,
plugin: import('stylelint').Plugin<any, any>
) => {
ruleName: string;
rule: import('stylelint').Rule<any, any>;
};
createLinter: (
options: import('stylelint').LinterOptions
) => import('stylelint').InternalApi;
utils: {
report: (problem: import('stylelint').Problem) => void;
ruleMessages: <
T extends import('stylelint').RuleMessages,
R extends { [K in keyof T]: T[K] }
>(
ruleName: string,
messages: T
) => R;
validateOptions: (
result: import('stylelint').PostcssResult,
ruleName: string,
...optionDescriptions: import('stylelint').RuleOptions[]
) => boolean;
checkAgainstRule: <T_1, O extends Object>(
options: {
ruleName: string;
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
root: import('stylelint/node_modules/postcss').Root;
},
callback: (
warning: import('stylelint/node_modules/postcss').Warning
) => void
) => void;
};
};
export type LintResult = import('stylelint').LintResult;
export type Compiler = import('webpack').Compiler;
export type Compilation = import('webpack').Compilation;
Expand Down
50 changes: 49 additions & 1 deletion declarations/options.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="stylelint" />
/** @typedef {import("stylelint")} stylelint */
/** @typedef {import("stylelint").LinterOptions} StylelintOptions */
/** @typedef {import("stylelint").FormatterType} FormatterType */
Expand Down Expand Up @@ -36,7 +37,54 @@ export function getOptions(pluginOptions: Options): Partial<PluginOptions>;
export function getStylelintOptions(
pluginOptions: Options
): Partial<StylelintOptions>;
export type stylelint = typeof import('stylelint');
export type stylelint = import('stylelint/node_modules/postcss').PluginCreator<
import('stylelint').PostcssPluginOptions
> & {
lint: (
options: import('stylelint').LinterOptions
) => Promise<import('stylelint').LinterResult>;
rules: {
[k: string]: import('stylelint').Rule<any, any>;
};
formatters: {
[k: string]: import('stylelint').Formatter;
};
createPlugin: (
ruleName: string,
plugin: import('stylelint').Plugin<any, any>
) => {
ruleName: string;
rule: import('stylelint').Rule<any, any>;
};
createLinter: (
options: import('stylelint').LinterOptions
) => import('stylelint').InternalApi;
utils: {
report: (problem: import('stylelint').Problem) => void;
ruleMessages: <
T extends import('stylelint').RuleMessages,
R extends { [K in keyof T]: T[K] }
>(
ruleName: string,
messages: T
) => R;
validateOptions: (
result: import('stylelint').PostcssResult,
ruleName: string,
...optionDescriptions: import('stylelint').RuleOptions[]
) => boolean;
checkAgainstRule: <T_1, O extends Object>(
options: {
ruleName: string;
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
root: import('stylelint/node_modules/postcss').Root;
},
callback: (
warning: import('stylelint/node_modules/postcss').Warning
) => void
) => void;
};
};
export type StylelintOptions = import('stylelint').LinterOptions;
export type FormatterType = import('stylelint').FormatterType;
export type OutputReport = {
Expand Down
50 changes: 49 additions & 1 deletion declarations/worker.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
export type Stylelint = typeof import('stylelint');
/// <reference types="stylelint" />
export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
import('stylelint').PostcssPluginOptions
> & {
lint: (
options: import('stylelint').LinterOptions
) => Promise<import('stylelint').LinterResult>;
rules: {
[k: string]: import('stylelint').Rule<any, any>;
};
formatters: {
[k: string]: import('stylelint').Formatter;
};
createPlugin: (
ruleName: string,
plugin: import('stylelint').Plugin<any, any>
) => {
ruleName: string;
rule: import('stylelint').Rule<any, any>;
};
createLinter: (
options: import('stylelint').LinterOptions
) => import('stylelint').InternalApi;
utils: {
report: (problem: import('stylelint').Problem) => void;
ruleMessages: <
T extends import('stylelint').RuleMessages,
R extends { [K in keyof T]: T[K] }
>(
ruleName: string,
messages: T
) => R;
validateOptions: (
result: import('stylelint').PostcssResult,
ruleName: string,
...optionDescriptions: import('stylelint').RuleOptions[]
) => boolean;
checkAgainstRule: <T_1, O extends Object>(
options: {
ruleName: string;
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
root: import('stylelint/node_modules/postcss').Root;
},
callback: (
warning: import('stylelint/node_modules/postcss').Warning
) => void
) => void;
};
};
export type StylelintOptions = import('stylelint').LinterOptions;
export type Options = import('./options').Options;
Loading