Rules Reference
Below you can find all rules of the `@sap/eslint-plugin-cds` ESLint plugin.
They are grouped by categories Model Validation and Environment to help you understand their purpose.
Your standard CDS project configuration turns on a subset of these rules by default, namely the recommended ( ✅ ) rules to ensure basic standards are met.
Model Validation
Model Validation rules are used to validate CDS models within projects. They are used to enforce security, naming conventions, or other best practices.
Note, that while all recommended ( ✅ ) model rules run with the CLI, only a number of them are enabled and visible in the editor by default ( 👀 ).
Details
- Editor default rules: Rules that are enabled in the editor by default only rely on the current file as their rule context. These are quick to execute and can react on file changes.
- Project-based rules: Rules that are disabled in the editor by default usually rely on a series of (project) files for their rule context or include slow or expensive processes. These are slow to execute and by default only run with the CLI.
- ✅ Recommended: If the plugin's recommended configuration enables the rule
- 🔧 Fixable: If problems reported by the rule are automatically fixable (
--fix
) - 💡 Has Suggestions: If problems reported by the rule are manually fixable
- 👀 Editor default: If the rule is shown in the editor by default
Recommended | Fixable | Suggestions | Editor | Rule |
---|---|---|---|---|
assoc2many-ambiguous-keyTO MANY relationship since entries could appear multiple times with the same key. | ||||
auth-no-empty-restrictions@restrict and @requires must not be empty. | ||||
auth-restrict-grant-service@restrict.grant on service level and for bound/unbound actions and functions is limited to grant: '*' | ||||
auth-use-requires@requires instead of @restrict.to in actions and services with unrestricted events. | ||||
auth-valid-restrict-grant@restrict.grant must have valid values. | ||||
auth-valid-restrict-keys@restrict must not have properties besides to , grant , and where . | ||||
auth-valid-restrict-to@restrict.to must have valid values. | ||||
auth-valid-restrict-where@restrict.where must have valid values. | ||||
extension-restrictions | ||||
no-db-keywords | ||||
no-dollar-prefixed-names | ||||
no-join-on-draftJOIN . | ||||
sql-cast-suggestion | ||||
start-elements-lowercase | ||||
start-entities-uppercase | ||||
valid-csv-header |
Environment
Environment rules are used to check for proper and up-to-date CDS project environments. These are only run via the command line and are not available in the editor as they often can't be pinpointed to any particular file.
- ✅ Recommended: If the plugin's recommended configuration enables the rule
- 🔧 Fixable: If problems reported by the rule are automatically fixable (
--fix
) - 💡 Has Suggestions: If problems reported by the rule are manually fixable
Recommended | Fixable | Suggestions | Rule |
---|---|---|---|
latest-cds-version@sap/cds version is being used. |