Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@commitlint/lint
Advanced tools
The @commitlint/lint package is a part of the commitlint toolset that is used to lint commit messages according to a specified set of rules. It helps maintain a consistent commit history and enforces a commit message convention, which is beneficial for automated processing of commit logs, generating changelogs, and aiding in code reviews.
Linting Commit Messages
This feature allows you to lint commit messages using a set of predefined rules. The code sample demonstrates how to use the lint function to check if a commit message follows the specified rules for the commit type and subject case.
const { lint } = require('@commitlint/lint');
const message = 'feat: add new feature';
const rules = {
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore']],
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']]
};
lint(message, rules).then(report => {
console.log(report);
});
commitlint is the core package that includes @commitlint/lint as part of its toolset. It provides a CLI and can be extended with plugins and shareable configurations. It is essentially the same tool but with a broader scope.
conventional-changelog-lint is a predecessor to commitlint and offers similar functionality for linting commit messages based on the conventional changelog standard. It has been deprecated in favor of commitlint.
validate-commit-msg is another deprecated package that was used to validate commit messages. It has been replaced by commitlint, which offers a more modern and flexible approach to commit message validation.
Lint a string against commitlint rules
npm install --save @commitlint/lint
const lint = require('@commitlint/lint').default;
lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}).then((report) =>
console.log(report)
);
// => { valid: true, errors: [], warnings: [] }
lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}).then((report) =>
console.log(report)
);
/* =>
{ valid: true,
errors: [],
warnings:
[ { level: 1,
valid: false,
name: 'type-enum',
message: 'type must be one of [bar]' } ] }
*/
Consult docs/api for comprehensive documentation.
13.0.0 (2021-05-24)
add subject-exclamation-mark rule to improve error messages (#2593) (be701bd)
chore!: remove node 10 support (#2596) (4db4ba1), closes #2596
FAQs
Lint a string against commitlint rules
The npm package @commitlint/lint receives a total of 2,331,843 weekly downloads. As such, @commitlint/lint popularity was classified as popular.
We found that @commitlint/lint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.