Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
eslint-plugin-css
Advanced tools
An ESLint plugin that provides rules to verify CSS definition objects.
eslint-plugin-css is an ESLint plugin that provides rules to verify CSS definition objects.
::: WORKING IN PROGRESS :::
This ESLint plugin provides linting rules to verify CSS definition objects.
You can check on the Online DEMO.
Stylelint partially supports CSS in JS, but some issues haven't been resolved for a long time.
Also, CSS definitions using template literals are similar to CSS syntax, but CSS definitions using JavaScript objects are not. ESLint may work better for linting JavaScript objects.
See documents.
npm install --save-dev eslint eslint-plugin-css
Requirements
- ESLint v7.0.0 and above
- Node.js v12.22.x, v14.17.x, v16.x and above
Add css
to the plugins section of your .eslintrc
configuration file (you can omit the eslint-plugin-
prefix)
and either use one of the two configurations available (recommended
or all
) or configure the rules you want:
The plugin:css/recommended
config enables a subset of the rules that should be most useful to most users.
See lib/configs/recommended.ts for more details.
// .eslintrc.js
module.exports = {
"plugins": [
"css"
],
"extends": [
// add more generic rulesets here, such as:
// 'eslint:recommended',
"plugin:css/recommended"
]
}
Override/add specific rules configurations. See also: http://eslint.org/docs/user-guide/configuring.
// .eslintrc.js
module.exports = {
"plugins": [
"css"
],
"rules": {
// Override/add rules settings here, such as:
"css/rule-name": "error"
}
}
"plugin:css/all"
The plugin:css/all
config enables all rules. It's meant for testing, not for production use because it changes with every minor and major version of the plugin. Use it at your own risk.
See lib/configs/all.ts for more details.
The --fix
option on the command line automatically fixes problems reported by rules which have a wrench :wrench: below.
The rules with the following star :star: are included in the plugin:css/recommended
config.
Rule ID | Description | |
---|---|---|
css/no-dupe-properties | disallow duplicate properties | :star: |
css/no-invalid-color-hex | disallow invalid hex colors | :star: |
css/no-unknown-property | disallow unknown properties | :star: |
css/no-unknown-unit | disallow unknown units | :star: |
Rule ID | Description | |
---|---|---|
css/no-length-zero-unit | disallow units for zero lengths | :wrench: |
Rule ID | Description | |
---|---|---|
css/property-casing | enforce specific casing for CSS properties | :wrench: |
See Settings.
Welcome contributing!
Please use GitHub's Issues/PRs.
See CONTRIBUTING.md.
npm test
runs tests and measures coverage.npm run update
runs in order to update readme and recommended configuration.npm run new [new rule name]
runs to create the files needed for the new rule.npm run docs:watch
starts the website locally.See the LICENSE file for license rights and limitations (MIT).
FAQs
An ESLint plugin that provides rules to verify CSS definition objects.
The npm package eslint-plugin-css receives a total of 14,477 weekly downloads. As such, eslint-plugin-css popularity was classified as popular.
We found that eslint-plugin-css demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.