donov4n / stylelint-find-new-rules Goto Github PK
View Code? Open in Web Editor NEWFind stylelint rules that you don't have in your custom config.
Home Page: https://npm.im/stylelint-find-new-rules
License: MIT License
Find stylelint rules that you don't have in your custom config.
Home Page: https://npm.im/stylelint-find-new-rules
License: MIT License
I'm using the stylelint-find-new-rules
script to find all rules which are currently not configured.
In Stylelint v15, all stylistic rules are marked as deprecated, so I've removed them from my configuration.
Now stylelint-find-new-rules
lists all of them as [UNUSED] Available rules that are not configured
.
Is it possible through the command line tool to show all unused rules, which are NOT marked as deprecated? Because it does not make sense to add deprecated rules.
--no-d
has no effect.
stylelint
allows to use
[...] either plugin objects or "locaters" identifying the plugins [...]
See https://stylelint.io/user-guide/configure/#plugins
If I'm using plugin objects (either directly or by importing them using require/dynamic imports), stylelint-find-new-rules
stops with the error:
Error: The "id" argument must be of type string. Received [Object: null prototype] [Module]
The problem is here:
were you don't check if the plugin is a "locater" or a plugin object.
Similar to #12, can this package be updated to support Stylelint v15?
https://github.com/stylelint/stylelint/blob/main/docs/migration-guide/to-15.md
npm ERR! Found: [email protected]
npm ERR! node_modules/stylelint
npm ERR! dev stylelint@"^15.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer stylelint@"^14" from [email protected]
npm ERR! node_modules/stylelint-find-new-rules
npm ERR! dev stylelint-find-new-rules@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
At the moment the CLI stops with an exit code of 0 regardless of what outdated / invalid / unused rules it found.
I would like to use this tool so I know exactly what rules have been introduced in the selection of plugins I'm using, and what might be changing in plugins. It would be nice to be able to do this in CI, so the build of my config breaks if an outdated / invalid rule is used โย a non-zero exit code would be a nice way to do that.
In the meantime I'm manually checking the output from the tool:
stylelint-find-new-rules src/unused.js --unused --deprecated --invalid | tee /dev/tty | grep 'All rules are up-to-date!' -c -q
This works, but feels unnecessarily complex.
We inherit from a local file, which causes an error with stylelint-find-new-rules
:
$ stylelint-find-new-rules
Error: Invalid or unexpected token
Here's our .stylelintrc.yml
:
extends:
- stylelint-config-standard-scss
- ./.stylelint_todo.yml
# This configuration was generated by `exe/stylelint_autogen`
# on 2022-03-02 23:08:55 UTC.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
overrides:
# Offense count: 11
- rules: { 'at-rule-empty-line-before': null }
files:
- app/assets/stylesheets/application.scss
- app/assets/stylesheets/jquery_ui.scss
- app/assets/stylesheets/legacy.scss
# Offense count: 2
- rules: { 'block-closing-brace-empty-line-before': null }
files:
- app/assets/stylesheets/refresh/_layouts.scss
- app/assets/stylesheets/refresh/pages/_campaigns.scss
# Offense count: 1
- rules: { 'block-closing-brace-newline-before': null }
files:
- app/assets/stylesheets/refresh/pages/_steps.scss
# Offense count: 5
- rules: { 'declaration-block-no-redundant-longhand-properties': null }
files:
- app/assets/stylesheets/refresh/_layouts.scss
- app/assets/stylesheets/refresh/pages/_console.scss
- app/assets/stylesheets/refresh/pages/_forms_team.scss
- app/assets/stylesheets/refresh/pages/_inbox.scss
# Offense count: 1
- rules: { 'declaration-block-trailing-semicolon': null }
files:
- app/assets/stylesheets/refresh/pages/_steps.scss
# Offense count: 4
- rules: { 'declaration-colon-newline-after': null }
files:
- app/assets/stylesheets/components/_fields.scss
- app/assets/stylesheets/doc_editor/_context_menu.scss
- app/assets/stylesheets/vendor/_fonts.scss
# Offense count: 2
- rules: { 'font-family-name-quotes': null }
files:
- app/assets/stylesheets/refresh/pages/_campaigns.scss
# Offense count: 2
- rules: { 'font-family-no-missing-generic-family-keyword': null }
files:
- app/assets/stylesheets/refresh/pages/_campaigns.scss
# Offense count: 16
- rules: { 'indentation': null }
files:
- app/assets/stylesheets/components/_fields.scss
- app/assets/stylesheets/doc_editor/_context_menu.scss
- app/assets/stylesheets/vendor/_fonts.scss
# Offense count: 73
- rules: { 'max-empty-lines': null }
files:
- app/assets/stylesheets/legacy/variables/_bootstrap.scss
- app/assets/stylesheets/refresh/pages/_campaigns.scss
- app/assets/stylesheets/refresh/pages/_test_approvers.scss
- app/assets/stylesheets/refresh/variables/_bootstrap.scss
# Offense count: 19
- rules: { 'max-line-length': null }
files:
- app/assets/stylesheets/legacy/variables/_bootstrap.scss
- app/assets/stylesheets/mailer.css.scss
- app/assets/stylesheets/refresh/variables/_bootstrap.scss
- app/assets/stylesheets/vendor/_fonts.scss
# Offense count: 1
- rules: { 'no-extra-semicolons': null }
files:
- app/assets/stylesheets/refresh/pages/_campaigns.scss
# Offense count: 1
- rules: { 'property-no-unknown': null }
files:
- app/assets/stylesheets/mailer.css.scss
# Offense count: 3
- rules: { 'property-no-vendor-prefix': null }
files:
- app/assets/stylesheets/admin.scss
- app/assets/stylesheets/mailer.css.scss
# Offense count: 25
- rules: { 'scss/at-extend-no-missing-placeholder': null }
files:
- app/assets/stylesheets/doc_editor/_toolbar.scss
- app/assets/stylesheets/legacy.scss
- app/assets/stylesheets/legacy/bootstrap_with_overrides.scss
- app/assets/stylesheets/refresh/extensions/_bootstrap.scss
- app/assets/stylesheets/refresh/overrides/_bootstrap.scss
- app/assets/stylesheets/refresh/pages/_responses.scss
- app/assets/stylesheets/wizard.scss
# Offense count: 1
- rules: { 'scss/at-import-partial-extension': null }
files:
- app/assets/stylesheets/jquery_ui.scss
# Offense count: 1
- rules: { 'scss/at-mixin-argumentless-call-parentheses': null }
files:
- app/assets/stylesheets/group_wizard/_reviewer_column.scss
# Offense count: 88
- rules: { 'scss/comment-no-empty': null }
files:
- app/assets/stylesheets/actiontext.scss
- app/assets/stylesheets/legacy/variables/_bootstrap.scss
- app/assets/stylesheets/refresh/variables/_bootstrap.scss
# Offense count: 274
- rules: { 'scss/dollar-variable-colon-space-after': null }
files:
- app/assets/stylesheets/legacy/variables/_bootstrap.scss
- app/assets/stylesheets/refresh/variables/_bootstrap.scss
# Offense count: 1
- rules: { 'scss/dollar-variable-empty-line-before': null }
files:
- app/assets/stylesheets/wizard.scss
# Offense count: 437
- rules: { 'scss/double-slash-comment-whitespace-inside': null }
files:
- app/assets/stylesheets/actiontext.scss
- app/assets/stylesheets/components/_fields.scss
- app/assets/stylesheets/form_filler/_tooltips.scss
- app/assets/stylesheets/legacy/variables/_bootstrap.scss
- app/assets/stylesheets/legacy/variables/_colors.scss
- app/assets/stylesheets/refresh/variables/_bootstrap.scss
# Offense count: 15
- rules: { 'scss/no-global-function-names': null }
files:
- app/assets/stylesheets/legacy/variables/_bootstrap.scss
- app/assets/stylesheets/legacy/variables/_colors.scss
- app/assets/stylesheets/refresh/pages/_inbox.scss
- app/assets/stylesheets/refresh/variables/_bootstrap.scss
# Offense count: 4
- rules: { 'selector-attribute-quotes': null }
files:
- app/assets/stylesheets/refresh/extensions/_bootstrap.scss
- app/assets/stylesheets/refresh/pages/_header.scss
- app/assets/stylesheets/tree/_search_results.scss
# Offense count: 3
- rules: { 'selector-id-pattern': null }
files:
- app/assets/stylesheets/tree/campaigns/_new.scss
# Offense count: 2
- rules: { 'selector-no-vendor-prefix': null }
files:
- app/assets/stylesheets/components/_html_form_validation.scss
- app/assets/stylesheets/tree/_main.scss
# Offense count: 1
- rules: { 'selector-pseudo-class-no-unknown': null }
files:
- app/assets/stylesheets/admin.scss
# Offense count: 12
- rules: { 'value-keyword-case': null }
files:
- app/assets/stylesheets/legacy/variables/_bootstrap.scss
- app/assets/stylesheets/refresh/variables/_bootstrap.scss
# Offense count: 1
- rules: { 'value-list-comma-newline-after': null }
files:
- app/assets/stylesheets/vendor/_fonts.scss
# Offense count: 1
- rules: { 'value-no-vendor-prefix': null }
files:
- app/assets/stylesheets/refresh/pages/_routing.scss
rules:
# Offense count: 24
'alpha-value-notation': null
# Offense count: 26
'color-function-notation': null
# Offense count: 76
'declaration-empty-line-before': null
# Offense count: 79
'no-descending-specificity': null
# Offense count: 88
'number-leading-zero': null
# Offense count: 159
'scss/double-slash-comment-empty-line-before': null
# Offense count: 277
'scss/operator-no-unspaced': null
# Offense count: 214
'selector-class-pattern': null
# Offense count: 275
'string-quotes': null
Hi @Donov4n,
I created stylelint-find-rules
It's really cool that you took it a step forward.
I was wondering what was the reasoning behind making a new package instead of trying to collaborate on the exiting one (besides me not being so active on it)?
It would be great if this code could be updated to support Stylelint v14, because right now npm returns this error on installation:
npm ERR! Found: [email protected]
npm ERR! node_modules/stylelint
npm ERR! stylelint@"14.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer stylelint@"^13" from [email protected]
npm ERR! node_modules/stylelint-find-new-rules
npm ERR! dev stylelint-find-new-rules@"3.0.2" from the root project
This is happening on a bunch of rules that were transitioned from whitelist/blacklist to allow-list/disallowed-list (e.g. unit-blacklist/unit-whitelist).
[adrian@blackhole:~/dev/indico/src:style-lint *$]> npx stylelint-find-new-rules
npx: installed 68 in 2.488s
Error: Cannot use import statement outside a module
This happens during _gatherPluginsRules(extendedConfig)
; if I skip it for the stylelint-prettier/recommended
extends entry everything works fine; same if I remove this particular extend from my config.
is there hunger for fixing this tool to support Stylelint 16?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.