@sap/eslint-plugin-cds
Version:
ESLint plugin including recommended SAP Cloud Application Programming model and environment rules
68 lines (59 loc) • 2.02 kB
JavaScript
/**
* This file is used to store/share any constants for this plugin:
* - DEFAULT_RULE_CATEGORY: Default rule category (must be one of plugin's rule categories)
* - DEFAULT_RULE_SEVERITY: Default rule severity (must be one of those define by ESLint):
* https://eslint.org/docs/user-guide/configuring/rules#configuring-rules
* - DEFAULT_RULE_TYPE: Default rule type (must be one of those defined by ESLint):
* https://eslint.org/docs/developer-guide/working-with-rules#rule-basics
* - CUSTOM_RULES_DIR: Custom rules directory name in the user's project home
* (contains rules, docs, tests)
* - FILES: Files/file extensions which ESLint should lint with this plugin
* - MODEL_FILES: Files/file extensions which should can be compiled (to CSN)
* - GLOBALS: Globals which should be exposed to ESLint by this plugin
*/
const RULE_FLAVORS = ['parsed', 'inferred']
const RULE_CATEGORIES = {
model: 'Model Validation',
javascript: 'JavaScript Validation',
environment: 'Environment Validation',
csv: 'CSV Validation',
}
const DEFAULT_RULE_CATEGORY = 'Model Validation'
const DEFAULT_RULE_FLAVOR = RULE_FLAVORS[0]
const DEFAULT_RULE_SEVERITY = 'error'
const DEFAULT_RULE_TYPE = 'problem'
const PLUGIN_NAME = require('../package.json').name
const PLUGIN_SCOPE = '@sap'
const PLUGIN_PREFIX = `${PLUGIN_SCOPE}/cds`
const CUSTOM_RULES_DIR = '.cdslint'
const FILES = ['*.cds', '*.csn', '*.csv']
const MODEL_FILES = ['*.cds', '*.csn']
const GLOBALS = {
SELECT: true,
INSERT: true,
UPSERT: true,
UPDATE: true,
DELETE: true,
CREATE: true,
DROP: true,
CDL: true,
CQL: true,
CXL: true,
cds: true
}
module.exports = {
RULE_FLAVORS,
RULE_CATEGORIES,
DEFAULT_RULE_CATEGORY,
DEFAULT_RULE_FLAVOR,
DEFAULT_RULE_SEVERITY,
DEFAULT_RULE_TYPE,
PLUGIN_NAME,
PLUGIN_SCOPE,
PLUGIN_PREFIX,
CUSTOM_RULES_DIR,
FILES,
MODEL_FILES,
GLOBALS
}