sindresorhus/eslint-plugin-unicorn

Rule proposal: Prevent common typos in comments

Chiusa

#949 aperta il 21 dic 2020

 (9 commenti) (2 reazioni) (0 assegnatari)JavaScript (468 fork)user submission
help wantednew rule

Metriche repository

Star
 (5022 stelle)
Metriche merge PR
 (Merge medio 1g 16h) (399 PR mergiate in 30 g)

Descrizione

People often write node.js, NodeJS, etc, instead of Node.js. Would be nice to have a rule to detect such mistakes in code comments.

Just like the prevent-abbreviations rule, we could let users either add their own additions or completely replace the built-ins.

The rule format could be like this:

[
	{
		test: /\bnode\.?js\b/gi,
		value: 'Node.js'
	},
	{
		test: /\bStack\s?Overflow\b/gi,
		value: 'Stack Overflow'
	},
	{
		test: /\bjavascript\b/gi,
		value: 'JavaScript'
	},
	{
		test: [/\bmac\s?OS(?!\s?X)\b/gi, /(mac\s?)?OS\s?X/gi],
		value: 'macOS'
	},
	{
		test: /\bYou\s?Tube\b/gi,
		value: 'YouTube'
	},
	{
		test: /\bGit\s?Hub\b/gi,
		value: 'GitHub'
	}
];

Some more:

ios => iOS reddit => Reddit Gulp.js => Gulp gulp.js => Gulp Grunt.js => Grunt grunt.js => Grunt svg => SVG url => URL css => CSS html => HTML png => PNG jpg => JPG jpeg => JPEG NPM => npm Npm => npm bitcoin => Bitcoin Devops => DevOps Url => URL JQuery => jQuery IOS => iOS Typescript => TypeScript typescript => TypeScript

Opinionated ones: application => app applications => apps


Suggestions welcome for more.

Guida contributor