diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js b/test/fixtures/linter/rules/NoDeprecatedApi/library.js similarity index 75% rename from test/fixtures/linter/rules/NoDeprecatedApi/old_library.js rename to test/fixtures/linter/rules/NoDeprecatedApi/library.js index e0dcf7d2e..b95741bbb 100644 --- a/test/fixtures/linter/rules/NoDeprecatedApi/old_library.js +++ b/test/fixtures/linter/rules/NoDeprecatedApi/library.js @@ -21,12 +21,4 @@ sap.ui.define([ Library.init({ apiVersion: "2" }); - Library.init({ - apiVersion: 2 - }); - - // Should be ignored - Library.load({ - apiVersion: 23 - }); }); diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js b/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js new file mode 100644 index 000000000..fa14ad79e --- /dev/null +++ b/test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js @@ -0,0 +1,17 @@ +/*! + * ${copyright} + */ +sap.ui.define([ + "sap/ui/core/Lib", +], function (Library) { + "use strict"; + + Library.init({ + apiVersion: 2 + }); + + // Should be ignored + Library.load({ + apiVersion: 23 + }); +}); diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md index 04f1b1d20..3703d2480 100644 --- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md +++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md @@ -788,6 +788,93 @@ Generated by [AVA](https://avajs.dev). }, ] +## General: library.js + +> Snapshot 1 + + [ + { + coverageInfo: [], + errorCount: 7, + fatalErrorCount: 0, + filePath: 'library.js', + messages: [ + { + column: 2, + fatal: undefined, + line: 9, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 10, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 11, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 12, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 16, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 19, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 22, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + ], + warningCount: 0, + }, + ] + +## General: library_negative.js + +> Snapshot 1 + + [ + { + coverageInfo: [], + errorCount: 0, + fatalErrorCount: 0, + filePath: 'library_negative.js', + messages: [], + warningCount: 0, + }, + ] + ## General: manifest.json > Snapshot 1 @@ -1018,78 +1105,6 @@ Generated by [AVA](https://avajs.dev). }, ] -## General: old_library.js - -> Snapshot 1 - - [ - { - coverageInfo: [], - errorCount: 7, - fatalErrorCount: 0, - filePath: 'old_library.js', - messages: [ - { - column: 2, - fatal: undefined, - line: 9, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 10, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 11, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 2, - fatal: undefined, - line: 12, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 16, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 19, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - { - column: 15, - fatal: undefined, - line: 22, - message: 'Call to Library.init() must be declared with property {apiVersion: 2}', - ruleId: 'ui5-linter-no-partially-deprecated-api', - severity: 2, - }, - ], - warningCount: 0, - }, - ] - ## General: sap.ui.jsview.js > Snapshot 1 @@ -1164,3 +1179,75 @@ Generated by [AVA](https://avajs.dev). warningCount: 0, }, ] + +## General: old_library.js + +> Snapshot 1 + + [ + { + coverageInfo: [], + errorCount: 7, + fatalErrorCount: 0, + filePath: 'old_library.js', + messages: [ + { + column: 2, + fatal: undefined, + line: 9, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 10, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 11, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 2, + fatal: undefined, + line: 12, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 16, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 19, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + { + column: 15, + fatal: undefined, + line: 22, + message: 'Call to Library.init() must be declared with property {apiVersion: 2}', + ruleId: 'ui5-linter-no-partially-deprecated-api', + severity: 2, + }, + ], + warningCount: 0, + }, + ] diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap index fa8647a62..aa25630db 100644 Binary files a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap and b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap differ