@sap/eslint-plugin-cds 3.2.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/LICENSE +15 -21
- package/lib/conf/index.js +17 -22
- package/lib/conf/js/all.js +8 -0
- package/lib/conf/js/recommended.js +8 -0
- package/lib/constants.js +7 -0
- package/lib/parser.js +2 -2
- package/lib/rules/index.js +17 -21
- package/lib/rules/js/CdsHandlerRule.js +265 -0
- package/lib/rules/js/no-cross-service-import.js +69 -0
- package/lib/rules/js/no-deep-sap-cds-import.js +56 -0
- package/lib/rules/js/no-shared-handler-variable.js +73 -0
- package/lib/rules/js/types.d.ts +15 -0
- package/lib/rules/js/use-cql-select-template-strings.js +35 -0
- package/lib/rules/latest-cds-version.js +2 -0
- package/lib/rules/no-db-keywords.js +2 -0
- package/lib/rules/no-dollar-prefixed-names.js +66 -8
- package/lib/rules/no-java-keywords.js +2 -0
- package/lib/rules/no-join-on-draft.js +3 -0
- package/lib/rules/sql-cast-suggestion.js +45 -21
- package/lib/rules/sql-null-comparison.js +37 -33
- package/lib/rules/start-elements-lowercase.js +3 -0
- package/lib/rules/start-entities-uppercase.js +2 -0
- package/lib/rules/valid-csv-header.js +2 -1
- package/lib/utils/createRule.js +9 -5
- package/lib/utils/getConfigPath.js +1 -12
- package/lib/utils/rules.js +10 -9
- package/lib/utils/runRuleTester.js +4 -12
- package/package.json +4 -4
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const fs = require('node:fs')
|
|
6
6
|
const path = require('node:path')
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const { RuleTester } = require('eslint')
|
|
9
9
|
const { globalCache } = require('./Cache')
|
|
10
10
|
const isConfiguredFileType = require('./isConfiguredFileType')
|
|
11
11
|
const { compileModelFromDict } = require('../parser')
|
|
@@ -56,6 +56,7 @@ module.exports = function runRuleTester(options) {
|
|
|
56
56
|
rule = testRuleWrapper(rules[path.basename(options.root)]())
|
|
57
57
|
} else {
|
|
58
58
|
// Otherwise from project root
|
|
59
|
+
|
|
59
60
|
// eslint-disable-next-line
|
|
60
61
|
const resolvedPlugin = require.resolve('@sap/eslint-plugin-cds', {
|
|
61
62
|
paths: [options.root]
|
|
@@ -66,9 +67,7 @@ module.exports = function runRuleTester(options) {
|
|
|
66
67
|
|
|
67
68
|
let tester
|
|
68
69
|
if (parserPath) {
|
|
69
|
-
const options =
|
|
70
|
-
? { languageOptions: { parser: require(parserPath) } }
|
|
71
|
-
: { parser: parserPath }
|
|
70
|
+
const options = { languageOptions: { parser: require(parserPath) } }
|
|
72
71
|
tester = new RuleTester(options)
|
|
73
72
|
} else {
|
|
74
73
|
tester = new RuleTester()
|
|
@@ -82,10 +81,7 @@ module.exports = function runRuleTester(options) {
|
|
|
82
81
|
filename: filePath,
|
|
83
82
|
}
|
|
84
83
|
]
|
|
85
|
-
|
|
86
|
-
// property not supported for ESLint 8
|
|
87
|
-
testerCases[type][0].name = `${path.basename(options.root)}/${type}/${options.filename}`
|
|
88
|
-
}
|
|
84
|
+
testerCases[type][0].name = `${path.basename(options.root)}/${type}/${options.filename}`
|
|
89
85
|
if (!isConfiguredFileType(options.filename, 'FILES')) {
|
|
90
86
|
const fileContents = JSON.parse(fs.readFileSync(filePath, 'utf8'))
|
|
91
87
|
testerCases[type][0].code = ''
|
|
@@ -150,7 +146,3 @@ function _getDictFiles(input, filenames) {
|
|
|
150
146
|
}
|
|
151
147
|
return dictFiles
|
|
152
148
|
}
|
|
153
|
-
|
|
154
|
-
function _isEslint9OrLater() {
|
|
155
|
-
return Number(Linter.version.split('.')[0]) >= 9
|
|
156
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap/eslint-plugin-cds",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "ESLint plugin including recommended SAP Cloud Application Programming model and environment rules",
|
|
5
5
|
"homepage": "https://cap.cloud.sap/",
|
|
6
6
|
"keywords": [
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sap/cds": ">=7",
|
|
24
23
|
"semver": "^7.7.1"
|
|
25
24
|
},
|
|
26
25
|
"peerDependencies": {
|
|
27
|
-
"
|
|
26
|
+
"@sap/cds": ">=9",
|
|
27
|
+
"eslint": "^9"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=20"
|
|
31
31
|
}
|
|
32
32
|
}
|