Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
eslint-plugin-yml
Advanced tools
eslint-plugin-yml is an ESLint plugin that provides linting rules for YAML files. It helps ensure consistency and correctness in YAML files by enforcing specific coding standards and best practices.
Indentation
This rule enforces consistent indentation in YAML files. The example configuration sets the indentation to 2 spaces.
module.exports = {
'yml/indent': ['error', 2]
};
Key Sorting
This rule enforces sorted keys within YAML mappings. The example configuration sorts keys in ascending order, case-insensitively, and using natural sort order.
module.exports = {
'yml/sort-keys': ['error', 'asc', { 'caseSensitive': false, 'natural': true }]
};
No Empty Mapping Values
This rule disallows empty values in YAML mappings. The example configuration treats any empty mapping value as an error.
module.exports = {
'yml/no-empty-mapping-value': 'error'
};
yaml-lint is a simple linter for YAML files that checks for syntax errors. Unlike eslint-plugin-yml, it does not integrate with ESLint and offers fewer customization options.
eslint-plugin-yml is ESLint plugin provides linting rules for YAML.
This ESLint plugin provides linting rules for YAML.
You can check on the Online DEMO.
See documents.
npm install --save-dev eslint eslint-plugin-yml
Requirements
- ESLint v6.0.0 and above
- Node.js v8.10.0 and above
Use .eslintrc.*
file to configure rules. See also: https://eslint.org/docs/user-guide/configuring.
Example .eslintrc.js:
module.exports = {
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
'plugin:yml/recommended'
],
rules: {
// override/add rules settings here, such as:
// 'yml/rule-name': 'error'
}
}
This plugin provides configs:
plugin:yml/base
... Configuration to enable correct YAML parsing.plugin:yml/recommended
... Recommended configuration.See the rule list to get the rules
that this plugin provides.
If you want to run eslint
from the command line, make sure you include the .yaml
extension using the --ext
option or a glob pattern, because ESLint targets only .js
files by default.
Examples:
eslint --ext .js,.yaml,.yml src
eslint "src/**/*.{js,yaml,yml}"
Use the dbaeumer.vscode-eslint extension that Microsoft provides officially.
You have to configure the eslint.validate
option of the extension to check .yaml
files, because the extension targets only *.js
or *.jsx
files by default.
Example .vscode/settings.json:
{
"eslint.validate": [
"javascript",
"javascriptreact",
"yaml"
]
}
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 config.
Rule ID | Description | Fixable | RECOMMENDED |
---|---|---|---|
yml/block-mapping | require or disallow block style mappings. | :wrench: | |
yml/block-sequence | require or disallow block style sequences. | :wrench: | |
yml/indent | enforce consistent indentation | :wrench: | |
yml/no-tab-indent | disallow tabs for indentation. | :star: |
Rule ID | Description | Fixable | RECOMMENDED |
---|---|---|---|
yml/flow-mapping-curly-newline | enforce consistent line breaks inside braces | :wrench: | |
yml/flow-mapping-curly-spacing | enforce consistent spacing inside braces | :wrench: | |
yml/flow-sequence-bracket-newline | enforce linebreaks after opening and before closing flow sequence brackets | :wrench: | |
yml/flow-sequence-bracket-spacing | enforce consistent spacing inside flow sequence brackets | :wrench: | |
yml/no-irregular-whitespace | disallow irregular whitespace | :star: | |
yml/spaced-comment | enforce consistent spacing after the # in a comment | :wrench: |
Welcome contributing!
Please use GitHub's Issues/PRs.
npm test
runs tests and measures coverage.npm run update
runs in order to update readme and recommended configuration.See the LICENSE file for license rights and limitations (MIT).
FAQs
This ESLint plugin provides linting rules for YAML.
The npm package eslint-plugin-yml receives a total of 424,657 weekly downloads. As such, eslint-plugin-yml popularity was classified as popular.
We found that eslint-plugin-yml 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.