The standard guide to convention for Starscraper projects
Install the package
$ npm install eslint-plugin-starscraper
Enforce the consistancy of Test Id naming convention
-
Example:
screenName.shortDescription.elementType
-
Screen Name (home, login, sign-out) - must match filename (you can use "context.getFilename()")
-
Short Description (welcome, explanation, info) - allow only alphabetic characters, enforce camel casing and 20 character max string length
-
Element Type (button, link, paragraph, input, subHeader) - use an enum to validate the type allowed
-
Enforce the consistancy of Intl Id naming convention
-
Example: 'screenName.shortDescription.elementType.textType'
-
Screen Name (home, login, sign-out) - must match filename (you can use "context.getFilename()")
-
Short Description (welcome, explanation, info) - allow only alphabetic characters, enforce camel casing and 20 character max string length
-
Element Type (button, link, paragraph, input, subHeader) - use an enum to validate the type allowed
-
Text Type (text, placeHolder, message, errorMessage, loadingText, hoverText) - use an enum to validate the type allowed
-
Enforce Test Id is unique across files
Enforce Intl Id is unique across files
Enforce Intl with Id , defaultMessage and description property
Absolute pixel values can never be provided to font-sizes, margins, or padding
Add the plugin to the list of plugins in the .eslintrc file
{
-----------
"plugins": [
"starscraper"
],
--------------
}
Add to rule(s)
{
-----------
"rules": {
"starscraper/test-id-match": "error",
"starscraper/intl-id-match": "error",
"starscraper/unique-test-ids": "error",
"starscraper/unique-intl-ids": "error",
"starscraper/required-fields-for-intl": "error",
"starscraper/spacing-system": "error",
},
--------------
}