Comments (11)
I'm not a fan of max-len rules in linters, but I get your frustration.
I think we could split long if
statements in value-keyword-case
and other files.
Before:
if (node.type !== "word" || !isStandardSyntaxValue(node.value) || value.indexOf("#") !== -1 || ignoredCharacters.has(keyword) || getUnitFromValueNode(node)) {
return
}
if (prop === "animation" && !keywordSets.animationShorthandKeywords.has(valueLowerCase) && !keywordSets.animationNameKeywords.has(valueLowerCase)) {
return
}
After:
if (
node.type !== "word"
|| !isStandardSyntaxValue(node.value)
|| value.indexOf("#") !== -1
|| ignoredCharacters.has(keyword)
|| getUnitFromValueNode(node)
) {
return
}
if (
prop === "animation"
&& !keywordSets.animationShorthandKeywords.has(valueLowerCase)
&& !keywordSets.animationNameKeywords.has(valueLowerCase)
) {
return
}
Also value-keyword-case
has this lines:
if (expectation === "lower" && mapLowercaseKeywordsToCamelCase.has(keywordLowerCase)) {
expectedKeyword = mapLowercaseKeywordsToCamelCase.get(keywordLowerCase)
}
They are 95 and 81 characters long. max-len: 80
is too short.
from eslint-config-stylelint.
I think we could add more options:
"ignoreComments": true
"ignoreUrls": true
"ignoreStrings": true
"ignoreTemplateLiterals": true
We have long quoted lines in tests. And for messages.
from eslint-config-stylelint.
@hudochenkov sgtm to me for split long if statements, but good have lint errors or warnings to never forget it, the only solution I see setting rules on the length of the line.
from eslint-config-stylelint.
I'm indifferent to whether this is included or not.
You both make good points either way. Would max-len: 120
be an acceptable compromise?
It flags 192 warnings. It seems a lot of them are from conditionals in the rule code as exampled above, so it would be good at catching those:
if (node.type !== "word" || !isStandardSyntaxValue(node.value) || value.indexOf("#") !== -1 || ignoredCharacters.has(keyword) || getUnitFromValueNode(node)) {
return
}
from eslint-config-stylelint.
@jeddy3 good for me
from eslint-config-stylelint.
max-len: 120
looks good for me.
It would throw a warning on a legit lines:
const isBlocklessAtRuleAfterSameNameBlocklessAtRule = require("../../utils/isBlocklessAtRuleAfterSameNameBlocklessAtRule")
This name 😂
But will help make the code more clear:
before = before[before.length - 1] === "*" || before[before.length - 1] === "_" ? before.slice(0, before.length - 1) : before
from eslint-config-stylelint.
@hudochenkov we can think about rename to more simple name or
const someLongLongLongLongVartiables
= require('some-long-module-name-more-than-120-characters-in-line')
from eslint-config-stylelint.
Or just add // eslint-disable-line max-len
:)
from eslint-config-stylelint.
@davidtheclark Any objections to max-len: [2, 120]
? If not, we can PR this before the next release of the config.
from eslint-config-stylelint.
I'm fine what whatever you all want.
from eslint-config-stylelint.
Done in #24
from eslint-config-stylelint.
Related Issues (20)
- Loosen `no-console` rule HOT 2
- Release 5.1.0 HOT 1
- Add eslint-plugin-regexp HOT 9
- Release 15.0.0 HOT 8
- Remove space inside multi item arrays HOT 1
- Exclude Jest configs by default HOT 1
- For any enum its throwing a no-shadow rule error HOT 2
- Add `eslint-plugin-import` HOT 5
- Postponing 7.0.0 release HOT 4
- Publish 8.0.0 HOT 1
- enable some stylistic rules HOT 1
- Version 10 of node.js has been released
- Use `smart` option of `eqeqeq` rule HOT 1
- Use `ignoreRestSiblings` option of `no-unused-vars` rule HOT 2
- Adapt rules after the upstream PRs are merged HOT 1
- Enforce use of modern syntax using unicorn plugin HOT 8
- Enable rule `padded-blocks` HOT 10
- Update outdated packages via Dependabot HOT 6
- Release 12.1.0 HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-config-stylelint.