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. |