@sap/eslint-plugin-webide-feature
v1.3.22
Published
Custom ESlint rules and recommended configuration specific for SAP Web IDE features
Downloads
18
Readme
ESLint plugin for SAP Web IDE features
Table of contents
Overview
This is the eslint plugin for Web IDE features. It contains a set of eslint rules and recommended ESLint configuration for static code checks to be used by Web IDE feature developers.
Usage
Add linting to tests
To add this package as a dependency in your package.json file, do the following:
- Under the "scripts" section, add:
"lint": "eslint src"
- Under the "scripts" section, add: "npm run lint" to the test section:
"test": "npm run lint && ..."
- Under the "devDependencies" section, add the following dependency:
"@sap/eslint-plugin-webide-feature": "a.b.c"
- Add
.eslintrc.json
file with the following content:
{
"plugins": ["@sap/webide-feature"],
"extends": "plugin:@sap/webide-feature/recommended-internal"
}
The linting checks will be executed as part of tests.
Please note that each version of this ESLint plugin corresponds to certain version of SAP Web IDE. As cloud version of SAP Web IDE is continiously updated it is strongly recommended to update the version of this plugin as soon as it is released. To update your feature to use the latest version of ESLint plugin, run: npm install --save-exact @sap/eslint-plugin-webide-feature@latest
Fix existing lint issues
After you have added linting, please execute it with npm run lint
. Do not worry if you see lots of warnings and errors most of the can be fixed automatically with --fix option of ESLint, by running node_modules/.bin/eslint src --fix
. Remaining issues can be fixed manually or ignored by using special comments or overrding recommended configuration values. To fix the issues manually please refer to the documentation of specific rule.
List of rules
| Rule | Description | Recommended Severity | | :----------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------ | :------------------- | | no-private-methods | Do not invoke private methods | Error | | no-private-apis | Do not invoke private methods | Warning | | bundled-uris-valid | "bundledPlugins" and "bundledFeatures" arrays items must start with "file:" and have valid uri | Error | | no-deprecated-fields | package.json file should contain neither deprecatedPluginExtensions nor deprecatedConfigIncludes fields | Warning | | feature-description-valid | package.json file must contain description field | Warning | | homepage-url-valid | package.json file must contain a homepage field with a valid path | Warning | | package-json-exists | package.json file must exist in feature's root folder | Error | | consistent-ids | each package.json and plugin.json file must has consistent ids | Error | | feature-name-valid | package.json file must contain name field | Error | | no-optional-features | package.json file must not contain optionalBundledFeatures field | Error | | feature-author-valid | package.json file must contain an author field with name and icon | Warning | | feature-version-valid | package.json file must contain a version field | Error | | webide-dependencies-consistent | "webideDependencies" section should be declared properly | Error | | plugin-name-valid | plugin.json file must contain name field | Error | | plugin-provides-valid | service and interface file references in "plugin.json" file must be valid | Error | | no-unused-required-services | All required services of a plugin must be in use | Warning | | valid-json-files | All JSON files in a feature must be valid | Error |