Code Monkey home page Code Monkey logo

eslint-config-stylelint's Introduction

Stylelint

npm version Build Status npm downloads

A mighty CSS linter that helps you avoid errors and enforce conventions.

Features

It's mighty as it:

  • has over 100 built-in rules for modern CSS syntax and features
  • supports plugins so you can create your own custom rules
  • automatically fixes problems where possible
  • supports shareable configs that you can create or extend
  • can be customized to your exact needs
  • has 15k unit tests making it robust
  • is trusted by companies worldwide like Google and GitHub

And it can be extended to:

  • extract embedded styles from HTML, Markdown and CSS-in-JS template literals
  • parse CSS-like languages like SCSS, Sass, Less and SugarSS

How it'll help you

It'll help you avoid errors, for example:

  • invalid things, e.g. malformed grid areas
  • valid things that are problematic, e.g. duplicate selectors
  • unknown things, e.g. misspelled property names

And enforce conventions, for example:

  • disallow things, e.g. specific units
  • enforce naming patterns, e.g. for custom properties
  • set limits, e.g. the number of ID selectors
  • specify notations, e.g. for modern color functions

We recommend using a pretty printer like Prettier alongside Stylelint. Linters and pretty printers are complementary tools that work together to help you write consistent and error-free code.

Example output

Example

Guides

Contributors

Stylelint is maintained by volunteers. Without the code contributions from all these fantastic people, Stylelint would not exist. Become a contributor.

Sponsors

Thank you to all our sponsors! Become a sponsor.

Backers

Thank you to all our backers! Become a backer.

Website hosting

Deploys by Netlify

License

The MIT License.

eslint-config-stylelint's People

Contributors

davidtheclark avatar dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar hudochenkov avatar jeddy3 avatar m-allanson avatar mattxwang avatar ntwb avatar ota-meshi avatar qubyte avatar thibaudcolas avatar xhmikosr avatar ybiquitous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

eslint-config-stylelint's Issues

An eslint rule to sort items alphabetically in `Set`, `Map`, ...

What is the problem you're trying to solve?

There are several list we like to have sorted alphabetically.
Mainly for readability and maintainability.

For example : https://github.com/stylelint/stylelint/blob/9897bf1f712a4788fdffad63a023a93ad67845e1/lib/rules/custom-property-no-missing-var-function/index.mjs#L18-L38

What solution would you like to see?

Can we automate and enforce these with an eslint rule?

Then we don't have to document this and it should ease code review.

Release 5.1.0

Following up from #11 we should release eslint-config-stylelint v5.1.0

Replace `padding-line-between-statements` with `@stylistic/padding-line-between-statements`

What is the problem you're trying to solve?

We have the padding-line-between-statements rule, but this rule has been deprecated since ESLint v8.53.0.

'padding-line-between-statements': [
'error',
// Require blank lines after all directive prologues (e. g. 'use strict')
{
blankLine: 'always',
prev: 'directive',
next: '*',
},
// Disallow blank lines between all directive prologues (e. g. 'use strict')
{
blankLine: 'never',
prev: 'directive',
next: 'directive',
},
// Require blank lines after every sequence of variable declarations
{
blankLine: 'always',
prev: ['const', 'let', 'var'],
next: '*',
},
// Blank lines could be between variable declarations
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
// Require blank lines before all return statements
{
blankLine: 'always',
prev: '*',
next: 'return',
},
// Require blank lines before and after all following statements
{
blankLine: 'always',
prev: '*',
next: ['for', 'function', 'if', 'switch', 'try'],
},
{
blankLine: 'always',
prev: ['for', 'function', 'if', 'switch', 'try'],
next: '*',
},
],

What solution would you like to see?

So, we should remove it or replace it with the plugin rule @stylistic/padding-line-between-statements.

I lean toward removing it because:

  • This rule needs many customization for our projects.
  • I want to avoid adding a new dependency from the maintainability perspective.
  • I personally don't mind the code style forced by this rule.

However, they're not strong opinions. I'd like to hear other thoughts.

Note: This rule was added in #55. @hudochenkov, please let us know if you have any opinions.

Postponing 7.0.0 release

I thinks we should wait for a merge of stylelint's v8 branch into master. The reason is new rules will cause lots of errors. 2740 errors on v8 branch. Luckily eslint --fix will left only 32 errors. Those changes could potentially cause lots of merge conflicts.

Maybe we'll add new rules to config while waiting for v8 merge :)

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected πŸ€–


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Enable rule `padded-blocks`

Why?

  • We don't need extra spaces
  • Smaller extra spaces - less package weight
  • A strict code policy = good code
  • More readable code (subjective)

Exclude Jest configs by default

What is the problem you're trying to solve?

Like stylelint/create-stylelint#1, when we'd like to use Vitest instead of Jest, including the following Jest configs by default is not helpful because a Jest rule requires installing the Jest package:

"plugin:jest/recommended",
"plugin:jest/style",

See https://github.com/stylelint/stylelint-create/pull/1/files#r1088492886

What solution would you like to see?

I suggest adding one more config for Jest:

Default:

{
  "extends": ["stylelint"]
}

For Jest:

{
  "extends": ["stylelint/jest"]
}

This change should be a major release because of a breaking change.

Enforce use of modern syntax using unicorn plugin

Use String.includes. Ref: stylelint/stylelint#4464

Unfortunately, I'm not aware of an ESLint rule to enforce this. Only https://github.com/sindresorhus/eslint-plugin-unicorn

I think that @XhmikosR's PRs to move to modern functions like include, startsWith etc has made the code more understandable. I'm very much in favour of enforcing good practise with tooling and would be happy to see unicorn used in this config. We'd only turn on the rules that support @XhmikosR's changes, though.

Thoughts?

Loosen `no-console` rule

The ESLint no-console document says:

If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

stylelint is mainly used on Node.js, so it may be good to disable the no-console rule.
But console.log sometimes can be used for debugging on developing for Node.js, so I think we can loosen it via the allow option as follows:

{
  "no-console": ["error", { "allow": ["warn", "error"] }]
}

"no-console": "error",

See also https://github.com/stylelint/stylelint/pull/5012/files#r521424965

Add `eslint-plugin-import`

Update outdated packages via Dependabot

The last commit via Dependabot is 8cac1b2 (24 days ago), but I've noticed the following outdated packages:

$ npm outdated
Package                        Current   Wanted  Latest  Location
eslint                           7.3.1    7.9.0   7.9.0  eslint-config-stylelint
eslint-config-prettier          6.10.1   6.11.0  6.11.0  eslint-config-stylelint
eslint-plugin-eslint-comments    3.1.2    3.2.0   3.2.0  eslint-config-stylelint
eslint-plugin-jest              23.8.2  23.20.0  24.0.2  eslint-config-stylelint
np                               6.2.3    6.5.0   6.5.0  eslint-config-stylelint

I'd like to update the packages to use new rules, but Dependabot seems not working. πŸ€”

So, what about migrating GitHub powered Dependabot (using .github/dependabot.yml)? See the doc for details:
https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates

Add eslint-plugin-regexp

What is the problem you're trying to solve?

I'd like to reduce bugs related to a regex and make it safer to write a regex.

What solution would you like to see?

I suggest adding the eslint-plugin-regexp plugin which is a work by @ota-meshi (a member of our team).
The plugin is for "finding RegExp mistakes and RegExp style guide violations."

Demo

I tried the plugin on the v14 branch of the stylelint/stylelint repository. (HEAD: c1713eac)

  1. Install the plugin via npm i -D eslint-plugin-regexp
  2. Add "plugin:regexp/recommended" to eslintConfig.extends in package.json
  3. Run npm run lint:js -- -f codeframe

Result:

> [email protected] lint:js
> eslint . --cache --max-warnings=0 "-f" "codeframe"

error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/__tests__/standalone-syntax.test.js:23:39:
  21 | 		expect(results).toHaveLength(6);
  22 | 
> 23 | 		const safeParserExtensionsTest = /\.(css|pcss|postcss)$/i;
     | 		                                    ^
  24 | 
  25 | 		results
  26 | 			.filter((result) => !safeParserExtensionsTest.test(result.source))


error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/color-hex-alpha/index.js:16:16:
  14 | });
  15 | 
> 16 | const HEX = /^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
     |                ^
  17 | 
  18 | /** @type {import('stylelint').StylelintRule} */
  19 | const rule = (primary) => {


error: Unexpected character class range '0-9'. Use '\d' instead (regexp/prefer-d) at lib/rules/color-hex-case/index.js:18:17:
  16 | });
  17 | 
> 18 | const HEX = /^#[0-9A-Za-z]+/;
     |                 ^
  19 | const IGNORED_FUNCTIONS = new Set(['url']);
  20 | 
  21 | /** @type {import('stylelint').StylelintRule} */


error: Unexpected character class range '0-9'. Use '\d' instead (regexp/prefer-d) at lib/rules/color-hex-length/index.js:18:17:
  16 | });
  17 | 
> 18 | const HEX = /^#[0-9A-Za-z]+/;
     |                 ^
  19 | const IGNORED_FUNCTIONS = new Set(['url']);
  20 | 
  21 | /** @type {import('stylelint').StylelintRule} */


error: Unexpected character class range '0-9'. Use '\d' instead (regexp/prefer-d) at lib/rules/color-no-hex/index.js:17:17:
  15 | });
  16 | 
> 17 | const HEX = /^#[0-9A-Za-z]+/;
     |                 ^
  18 | const IGNORED_FUNCTIONS = new Set(['url']);
  19 | 
  20 | /** @type {import('stylelint').StylelintRule} */


error: Unexpected character class range '0-9'. Use '\d' instead (regexp/prefer-d) at lib/rules/color-no-invalid-hex/index.js:31:26:
  29 | 				if (type !== 'word') return;
  30 | 
> 31 | 				const hexMatch = /^#[0-9A-Za-z]+/.exec(value);
     | 				                     ^
  32 | 
  33 | 				if (!hexMatch) return;
  34 | 


error: '\r?' can be removed because it is already included by '\s*' (regexp/optimal-quantifier-concatenation) at lib/rules/declaration-colon-newline-after/index.js:67:14:
  65 | 							const betweenAfter = between.slice(sliceIndex);
  66 | 
> 67 | 							if (/^\s*\r?\n/.test(betweenAfter)) {
     | 							      ^
  68 | 								decl.raws.between = betweenBefore + betweenAfter.replace(/^[^\S\r\n]*/, '');
  69 | 							} else {
  70 | 								decl.raws.between = betweenBefore + context.newline + betweenAfter;


error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/font-family-name-quotes/index.js:55:12:
  53 | function quotesRequired(family) {
  54 | 	return family.split(/\s+/).some((word) => {
> 55 | 		return /^(-?\d|--)/.test(word) || !/^[-_a-zA-Z0-9\u{00A0}-\u{10FFFF}]+$/u.test(word);
     | 		         ^
  56 | 	});
  57 | }
  58 | 


error: Unexpected character class ranges '[_a-zA-Z0-9]'. Use '\w' instead (regexp/prefer-w) at lib/rules/font-family-name-quotes/index.js:55:40:
  53 | function quotesRequired(family) {
  54 | 	return family.split(/\s+/).some((word) => {
> 55 | 		return /^(-?\d|--)/.test(word) || !/^[-_a-zA-Z0-9\u{00A0}-\u{10FFFF}]+$/u.test(word);
     | 		                                     ^
  56 | 	});
  57 | }
  58 | 


error: Unexpected character class range '0-9'. Use '\d' instead (regexp/prefer-d) at lib/rules/font-family-name-quotes/index.js:55:49:
  53 | function quotesRequired(family) {
  54 | 	return family.split(/\s+/).some((word) => {
> 55 | 		return /^(-?\d|--)/.test(word) || !/^[-_a-zA-Z0-9\u{00A0}-\u{10FFFF}]+$/u.test(word);
     | 		                                              ^
  56 | 	});
  57 | }
  58 | 


error: Unescaped source character '{' (regexp/strict) at lib/rules/function-calc-no-unspaced-operator/index.js:244:38:
  242 |  */
  243 | function blurVariables(source) {
> 244 | 	return source.replace(/[$@][^)\s]+|#{.+?}/g, '0');
      | 	                                    ^
  245 | }
  246 | 
  247 | /**


error: Unescaped source character '}' (regexp/strict) at lib/rules/function-calc-no-unspaced-operator/index.js:244:42:
  242 |  */
  243 | function blurVariables(source) {
> 244 | 	return source.replace(/[$@][^)\s]+|#{.+?}/g, '0');
      | 	                                        ^
  245 | }
  246 | 
  247 | /**


error: Unescaped source character '{' (regexp/strict) at lib/rules/indentation/index.js:306:36:
  304 | 						}
  305 | 
> 306 | 						const followsOpeningBrace = /{[ \t]*$/.test(source.slice(0, newlineIndex));
      | 						                             ^
  307 | 
  308 | 						if (followsOpeningBrace) {
  309 | 							parentheticalDepth += 1;


error: Unescaped source character '}' (regexp/strict) at lib/rules/indentation/index.js:312:44:
  310 | 						}
  311 | 
> 312 | 						const startingClosingBrace = /^[ \t]*}/.test(source.slice(match.startIndex + 1));
      | 						                                     ^
  313 | 
  314 | 						if (startingClosingBrace) {
  315 | 							parentheticalDepth -= 1;


error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/indentation/index.js:610:17:
  608 | 
  609 | 		source = source.replace(/^[^\r\n]+/, (firstLine) => {
> 610 | 			if (/(?:^|\n)([ \t]*)$/.test(root.raws.beforeStart)) {
      | 			             ^
  611 | 				return RegExp.$1 + firstLine;
  612 | 			}
  613 | 


error: 'RegExp.$1' static property is forbidden (regexp/no-legacy-features) at lib/rules/indentation/index.js:611:12:
  609 | 		source = source.replace(/^[^\r\n]+/, (firstLine) => {
  610 | 			if (/(?:^|\n)([ \t]*)$/.test(root.raws.beforeStart)) {
> 611 | 				return RegExp.$1 + firstLine;
      | 				       ^
  612 | 			}
  613 | 
  614 | 			return '';


error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/max-empty-lines/index.js:164:12:
  162 | 			const emptyCRLFLines = '\r\n'.repeat(repeatTimes);
  163 | 
> 164 | 			return /(\r\n)+/g.test(str)
      | 			        ^
  165 | 				? str.replace(/(\r\n)+/g, ($1) => {
  166 | 						if ($1.length / 2 > repeatTimes) {
  167 | 							return emptyCRLFLines;


warning: The 'g' flag is unnecessary because the regex is used only once in 'RegExp.prototype.test' (regexp/no-useless-flag) at lib/rules/max-empty-lines/index.js:164:20:
  162 | 			const emptyCRLFLines = '\r\n'.repeat(repeatTimes);
  163 | 
> 164 | 			return /(\r\n)+/g.test(str)
      | 			                ^
  165 | 				? str.replace(/(\r\n)+/g, ($1) => {
  166 | 						if ($1.length / 2 > repeatTimes) {
  167 | 							return emptyCRLFLines;


error: '\r?' can be removed because it is already included by '\s*' (regexp/optimal-quantifier-concatenation) at lib/rules/media-query-list-comma-newline-after/index.js:68:19:
  66 | 
  67 | 						if (primary.startsWith('always')) {
> 68 | 							params = /^\s*\r?\n/.test(afterComma)
     | 							           ^
  69 | 								? beforeComma + afterComma.replace(/^[^\S\r\n]*/, '')
  70 | 								: beforeComma + context.newline + afterComma;
  71 | 						} else if (primary.startsWith('never')) {


error: Capturing group number 2 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/mediaQueryListCommaWhitespaceChecker.js:32:40:
  30 | 				}
  31 | 
> 32 | 				if ((execResult = /^([^\S\r\n]*\/\/([\s\S]*?))\r?\n/.exec(params.slice(index + 1)))) {
     | 				                                   ^
  33 | 					index += execResult[1].length;
  34 | 				}
  35 | 			}


error: The quantifier '\d*?' can exchange characters with '0+'. Using any string accepted by /0+/, this can be exploited to cause at least polynomial backtracking (regexp/no-super-linear-backtracking) at lib/rules/number-no-trailing-zeros/index.js:55:23:
  53 | 				}
  54 | 
> 55 | 				const match = /\.(\d*?)(0+)(?:\D|$)/.exec(valueNode.value);
     | 				                  ^
  56 | 
  57 | 				// match[1] is any numbers between the decimal and our trailing zero, could be empty
  58 | 				// match[2] is our trailing zero(s)


error: Unescaped source character ']' (regexp/strict) at lib/rules/selector-disallowed-list/__tests__/index.js:7:33:
   5 | testRule({
   6 | 	ruleName,
>  7 | 	config: ['a > .foo', /\[data-.+]/],
     | 	                               ^
   8 | 
   9 | 	accept: [
  10 | 		{


error: The quantifier '.*' can exchange characters with '.*'. Using any string accepted by />+/, this can be exploited to cause at least polynomial backtracking. This might cause exponential backtracking (regexp/no-super-linear-backtracking) at lib/rules/selector-disallowed-list/__tests__/index.js:63:17:
  61 | testRule({
  62 | 	ruleName,
> 63 | 	config: [/\.foo.*>.*\.bar/],
     | 	               ^
  64 | 
  65 | 	accept: [
  66 | 		{


error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/string-no-newline/index.js:15:20:
  13 | 
  14 | const ruleName = 'string-no-newline';
> 15 | const reNewLine = /(\r?\n)/;
     |                    ^
  16 | 
  17 | const messages = ruleMessages(ruleName, {
  18 | 	rejected: 'Unexpected newline in string',


error: 'RegExp.leftContext' static property is forbidden (regexp/no-legacy-features) at lib/rules/string-no-newline/index.js:65:7:
  63 | 						attributeNode.operator,
  64 | 						// length of the contents before newline
> 65 | 						RegExp.leftContext,
     | 						^
  66 | 					].reduce(
  67 | 						(index, str) => index + str.length,
  68 | 						// index of the start of our attribute node in our source


error: 'RegExp.leftContext' static property is forbidden (regexp/no-legacy-features) at lib/rules/string-no-newline/index.js:99:6:
   97 | 					valueNode.quote,
   98 | 					// length of the contents before newline
>  99 | 					RegExp.leftContext,
      | 					^
  100 | 				].reduce((index, str) => index + str.length, valueNode.sourceIndex);
  101 | 
  102 | 				report({


error: Capturing group number 2 is defined but never used (regexp/no-unused-capturing-group) at lib/rules/unit-disallowed-list/index.js:28:11:
  26 | 	const value = mediaFeatureNode.value.toLowerCase();
  27 | 
> 28 | 	return /((-?\w*)*)/i.exec(value)[1];
     | 	         ^
  29 | };
  30 | 
  31 | function rule(listInput, options) {


warning: The 'i' flag is unnecessary because the pattern only contains case-invariant characters (regexp/no-useless-flag) at lib/rules/unit-disallowed-list/index.js:28:21:
  26 | 	const value = mediaFeatureNode.value.toLowerCase();
  27 | 
> 28 | 	return /((-?\w*)*)/i.exec(value)[1];
     | 	                   ^
  29 | };
  30 | 
  31 | function rule(listInput, options) {


error: Unexpected character class '[0-9]'. Use '\d' instead (regexp/prefer-d) at lib/utils/checkInvalidCLIOptions.js:54:48:
  52 |  */
  53 | const kebabCase = (opt) => {
> 54 | 	const matches = opt.match(/[A-Z]?[a-z]+|[A-Z]|[0-9]+/g);
     | 	                                              ^
  55 | 
  56 | 	if (matches) {
  57 | 		return matches.map((s) => s.toLowerCase()).join('-');


error: Unescaped source character '{' (regexp/strict) at lib/utils/hasLessInterpolation.js:10:11:
   8 |  */
   9 | module.exports = function (string) {
> 10 | 	return /@{.+?}/.test(string);
     | 	         ^
  11 | };
  12 | 


error: Unescaped source character '}' (regexp/strict) at lib/utils/hasLessInterpolation.js:10:15:
   8 |  */
   9 | module.exports = function (string) {
> 10 | 	return /@{.+?}/.test(string);
     | 	             ^
  11 | };
  12 | 


error: Unescaped source character '{' (regexp/strict) at lib/utils/hasScssInterpolation.js:9:11:
   7 |  */
   8 | module.exports = function (string) {
>  9 | 	return /#{.+?}/.test(string);
     | 	         ^
  10 | };
  11 | 


error: Unescaped source character '}' (regexp/strict) at lib/utils/hasScssInterpolation.js:9:15:
   7 |  */
   8 | module.exports = function (string) {
>  9 | 	return /#{.+?}/.test(string);
     | 	             ^
  10 | };
  11 | 


error: Unescaped source character '{' (regexp/strict) at lib/utils/hasTplInterpolation.js:10:10:
   8 |  */
   9 | module.exports = function (string) {
> 10 | 	return /{.+?}/.test(string);
     | 	        ^
  11 | };
  12 | 


error: Unescaped source character '}' (regexp/strict) at lib/utils/hasTplInterpolation.js:10:14:
   8 |  */
   9 | module.exports = function (string) {
> 10 | 	return /{.+?}/.test(string);
     | 	            ^
  11 | };
  12 | 


error: The quantifier '\d+' can exchange characters with '\d*'. Using any string accepted by /\d+/, this can be exploited to cause at least polynomial backtracking (regexp/no-super-linear-backtracking) at lib/utils/isKeyframeSelector.js:17:11:
  15 | 
  16 | 	// Percentages
> 17 | 	if (/^(?:\d+\.?\d*|\d*\.?\d+)%$/.test(selector)) {
     | 	         ^
  18 | 		return true;
  19 | 	}
  20 | 


error: The quantifier '\d*' can exchange characters with '\d+'. Using any string accepted by /\d+/, this can be exploited to cause at least polynomial backtracking (regexp/no-super-linear-backtracking) at lib/utils/isKeyframeSelector.js:17:21:
  15 | 
  16 | 	// Percentages
> 17 | 	if (/^(?:\d+\.?\d*|\d*\.?\d+)%$/.test(selector)) {
     | 	                   ^
  18 | 		return true;
  19 | 	}
  20 | 


error: Unescaped source character '{' (regexp/strict) at lib/utils/isStandardSyntaxMediaFeatureName.js:11:8:
   9 | module.exports = function (mediaFeatureName) {
  10 | 	// SCSS interpolation
> 11 | 	if (/#{.+?}|\$.+?/.test(mediaFeatureName)) {
     | 	      ^
  12 | 		return false;
  13 | 	}
  14 | 


error: Unescaped source character '}' (regexp/strict) at lib/utils/isStandardSyntaxMediaFeatureName.js:11:12:
   9 | module.exports = function (mediaFeatureName) {
  10 | 	// SCSS interpolation
> 11 | 	if (/#{.+?}|\$.+?/.test(mediaFeatureName)) {
     | 	          ^
  12 | 		return false;
  13 | 	}
  14 | 


warning: The quantifier can be removed because the quantifier is lazy and has a minimum of 1 (regexp/no-lazy-ends) at lib/utils/isStandardSyntaxMediaFeatureName.js:11:16:
   9 | module.exports = function (mediaFeatureName) {
  10 | 	// SCSS interpolation
> 11 | 	if (/#{.+?}|\$.+?/.test(mediaFeatureName)) {
     | 	              ^
  12 | 		return false;
  13 | 	}
  14 | 


error: Capturing group number 1 is defined but never used (regexp/no-unused-capturing-group) at lib/utils/isStandardSyntaxSelector.js:28:14:
  26 | 
  27 | 	// Less :extend()
> 28 | 	if (/:extend(\(.*?\))?/.test(selector)) {
     | 	            ^
  29 | 		return false;
  30 | 	}
  31 | 


warning: The 'i' flag is unnecessary because the pattern only contains case-invariant characters (regexp/no-useless-flag) at lib/utils/isStandardSyntaxSelector.js:33:24:
  31 | 
  32 | 	// Less mixin with resolved nested selectors (e.g. .foo().bar or .foo(@a, @b)[bar])
> 33 | 	if (/\.[\w-]+\(.*\).+/i.test(selector)) {
     | 	                      ^
  34 | 		return false;
  35 | 	}
  36 | 


error: Unexpected obscure character range. The characters of '+-/' (U+002b - U+002f) are not obvious (regexp/no-obscure-range) at lib/utils/isStandardSyntaxUrl.js:43:35:
  41 | 	// But in this case it is allowed to use only specific characters
  42 | 	// Also forbidden "/" at the end of url
> 43 | 	if (url.includes('$') && /^[$\s\w+-/*'"/]+$/.test(url) && !url.endsWith('/')) {
     | 	                                 ^
  44 | 		return false;
  45 | 	}
  46 | 


error: '/' (U+002f) is already included in '+-/' (U+002b - U+002f) (regexp/no-dupe-characters-character-class) at lib/utils/isStandardSyntaxUrl.js:43:41:
  41 | 	// But in this case it is allowed to use only specific characters
  42 | 	// Also forbidden "/" at the end of url
> 43 | 	if (url.includes('$') && /^[$\s\w+-/*'"/]+$/.test(url) && !url.endsWith('/')) {
     | 	                                       ^
  44 | 		return false;
  45 | 	}
  46 | 


error: Unexpected character class range '0-9'. Use '\d' instead (regexp/prefer-d) at lib/utils/isValidHex.js:10:16:
   8 |  */
   9 | module.exports = function (value) {
> 10 | 	return /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value);
     | 	              ^
  11 | };
  12 | 


error: Unexpected character class range '0-9'. Use '\d' instead (regexp/prefer-d) at lib/utils/isValidHex.js:10:33:
   8 |  */
   9 | module.exports = function (value) {
> 10 | 	return /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value);
     | 	                               ^
  11 | };
  12 | 


error: Unexpected character class range '0-9'. Use '\d' instead (regexp/prefer-d) at lib/utils/isValidHex.js:10:48:
   8 |  */
   9 | module.exports = function (value) {
> 10 | 	return /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value);
     | 	                                              ^
  11 | };
  12 | 


error: '\r?' can be removed because it is already included by '\s*' (regexp/optimal-quantifier-concatenation) at lib/utils/removeEmptyLinesAfter.js:12:69:
  10 |  */
  11 | module.exports = function removeEmptyLinesAfter(node, newline) {
> 12 | 	node.raws.after = node.raws.after ? node.raws.after.replace(/(\r?\n\s*\r?\n)+/g, newline) : '';
     | 	                                                                   ^
  13 | 
  14 | 	return node;
  15 | };


error: '\r?' can be removed because it is already included by '\s*' (regexp/optimal-quantifier-concatenation) at lib/utils/removeEmptyLinesBefore.js:12:72:
  10 |  */
  11 | module.exports = function removeEmptyLinesBefore(node, newline) {
> 12 | 	node.raws.before = node.raws.before ? node.raws.before.replace(/(\r?\n\s*\r?\n)+/g, newline) : '';
     | 	                                                                      ^
  13 | 
  14 | 	return node;
  15 | };


45 errors and 4 warnings found.
31 errors and 3 warnings potentially fixable with the `--fix` option.

Summary:

45 errors and 4 warnings found.
31 errors and 3 warnings potentially fixable with the `--fix` option.

See also stylelint/stylelint#5516

Resources

Enable rule `max-len`

Some files difficult to read on smaller screens (value-keyword-case have line more than 167 characters), it spends time 😞 I don't know best value for this, i am use indent 4 and 120 characters max line in my projects, but here we use indent 2 and can use 80 characters max line.

Use `ignoreRestSiblings` option of `no-unused-vars` rule

I think the ignoreRestSiblings option of the no-unused-vars rule is useful when using rest properties like this:

// 'type' is ignored because it has a rest property sibling.
const { type, ...coords } = data;

If the option is not specified, we need disabling via inline comment:

// eslint-disable-next-line no-unused-vars
const { type, ...coords } = data;

I would be glad if anyone would give any feedback!

Adapt rules after the upstream PRs are merged

  • stylelint/stylelint#4462

    "array-callback-return": "error",
    "dot-notation": "error",
    "func-name-matching": "error",
    "guard-for-in": "error",
    "no-else-return": [
      "error",
      {
        "allowElseIf": false
      }
    ],
    "no-implicit-coercion": "error",
    "no-lonely-if": "error",
    "no-unneeded-ternary": "error",
    "no-useless-return": "error",
    "no-unused-vars": [
      "error",
      {
        "ignoreRestSiblings": true
      }
    ],
    "operator-assignment": "error",
    "prefer-object-spread": "error",
    "prefer-regex-literals": "error",
    "prefer-rest-params": "error",
    "prefer-spread": "error"
  • stylelint/stylelint#4429

    "prefer-template": "error"

Publish 8.0.0

8.0.0 is ready to publish, @jeddy3 can you pull the trigger please πŸ˜„

β€’ CHANGELOG.md updated for 8.0.0 243e3f5
β€’ package.json and package.lock.json updated to 8.0.0 e8d6980

All that is required is to run npm run release πŸŽ‰

For any enum its throwing a no-shadow rule error

What steps are needed to reproduce the bug?

Just add the stylelint to eslint extends.

Have a enum in tsx or ts file.

What did you expect to happen?

It should not throw no-shadow erorr for enums.

What actually happened?

Throwing the following error:
'xxx' is already declared in the upper scope on line 7 column 6. eslint(no-shadow)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.