Skip to content

feat: upgrade stylelint deps and config #703

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
19 changes: 11 additions & 8 deletions packages/stylelint-config/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
module.exports = {
processors: [
[
'stylelint-processor-styled-components',
{ strict: true, ignoreFiles: ['**/*.css'] }
]
],
extends: [
'stylelint-config-recommended',
'stylelint-config-standard',
'stylelint-config-css-modules',
'stylelint-config-styled-components',
'stylelint-config-prettier'
],
plugins: [
Expand All @@ -17,6 +10,16 @@ module.exports = {
'stylelint-declaration-block-no-ignored-properties',
'stylelint-selector-tag-no-without-class'
],
overrides: [
{
files: ['**/*.scss'],
customSyntax: require.resolve('postcss-scss')
},
{
files: ['**/*.less'],
customSyntax: require.resolve('postcss-less')
}
],
rules: {
'length-zero-no-unit': true,
'shorthand-property-no-redundant-values': true,
Expand Down
18 changes: 10 additions & 8 deletions packages/stylelint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@
"stylelint-config"
],
"dependencies": {
"postcss": "8.4.16",
"postcss-less": "6.0.0",
"postcss-scss": "4.0.4",
"stylelint-a11y": "1.2.3",
"stylelint-config-css-modules": "2.2.0",
"stylelint-config-prettier": "8.0.2",
"stylelint-config-css-modules": "4.1.0",
"stylelint-config-prettier": "9.0.3",
"stylelint-config-recommended": "3.0.0",
"stylelint-config-styled-components": "0.1.1",
"stylelint-declaration-block-no-ignored-properties": "2.3.0",
"stylelint-order": "4.1.0",
"stylelint-processor-styled-components": "1.10.0",
"stylelint-selector-tag-no-without-class": "2.0.3",
"stylelint-config-standard": "28.0.0",
"stylelint-declaration-block-no-ignored-properties": "2.5.0",
"stylelint-order": "5.0.0",
"stylelint-selector-tag-no-without-class": "2.0.5",
"tslib": "2.0.1"
},
"peerDependencies": {
"stylelint": ">7.x"
"stylelint": ">14.x"
}
}
4 changes: 2 additions & 2 deletions plugins/lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"eslint-formatter-pretty": "4.0.0",
"fast-glob": "3.2.5",
"get-monorepo-packages": "1.2.0",
"stylelint": "13.7.0",
"stylelint": "14.11.0",
"stylelint-formatter-github": "^1.0.0",
"stylelint-formatter-pretty": "2.1.0",
"stylelint-formatter-pretty": "3.1.0",
"tslib": "2.0.1"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion plugins/lint/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default class LintPlugin implements Plugin<LintArgs> {
try {
const jsReturnCode = await lintJS(args);
const cssReturnCode = await lintCSS(args);

logger.debug({ jsReturnCode, cssReturnCode });

if (jsReturnCode + cssReturnCode > 0) {
Expand Down
5 changes: 4 additions & 1 deletion plugins/lint/src/utils/helperUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ async function attemptStylelint(
try {
return (await stylelint.lint(options)) as StylelintResult;
} catch (error) {
if (error.message.includes('No files matching the pattern')) {
if (error?.message.includes('No files matching the pattern')) {
return {
cwd: "",
reportedDisables: [],
ruleMetadata: {},
results: [],
output: 'no match',
errored: false
Expand Down
4 changes: 2 additions & 2 deletions plugins/lint/src/utils/lintUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ async function lintCSS(args: LintArgs): Promise<number> {
warnings: [
...result.warnings,
...disables.ranges.map((range) => ({
rule: range.unusedRule,
rule: range.rule,
severity: 'warning' as stylelint.Severity,
text: 'Needless stylint-disable',
text: 'Needless stylelint-disable',
line: range.start,
column: 0,
})),
Expand Down
2 changes: 1 addition & 1 deletion typings/createStylelint.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare module 'stylelint/lib/createStylelint' {
function createStylelint(
options: Partial<stylelint.LinterOptions>
): {
getConfigForFile: (path: string) => { config: stylelint.Configuration };
getConfigForFile: (path: string) => { config: stylelint.Config };
};

export default createStylelint;
Expand Down
Loading