Skip to content

Commit

Permalink
refactor(messages)!: Drop 'ui5-linter-' prefix from rule names
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomByte committed Sep 17, 2024
1 parent 963a47d commit 119b61a
Show file tree
Hide file tree
Showing 17 changed files with 356 additions and 356 deletions.
76 changes: 38 additions & 38 deletions src/linter/messages.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// TODO: Migrate to enum instead of Object/Map
// Currently, it's done this way to avoid pollution of the test snapshots
const RULES = {
"ui5-linter-async-component-flags": "ui5-linter-async-component-flags",
"ui5-linter-no-deprecated-api": "ui5-linter-no-deprecated-api",
"ui5-linter-no-deprecated-parameter": "ui5-linter-no-deprecated-parameter",
"ui5-linter-no-deprecated-property": "ui5-linter-no-deprecated-property",
"ui5-linter-no-pseudo-modules": "ui5-linter-no-pseudo-modules",
"ui5-linter-no-globals": "ui5-linter-no-globals",
"ui5-linter-parsing-error": "ui5-linter-parsing-error",
"ui5-linter-no-deprecated-library": "ui5-linter-no-deprecated-library",
"ui5-linter-no-deprecated-component": "ui5-linter-no-deprecated-component",
"ui5-linter-csp-unsafe-inline-script": "ui5-linter-csp-unsafe-inline-script",
"async-component-flags": "async-component-flags",
"no-deprecated-api": "no-deprecated-api",
"no-deprecated-parameter": "no-deprecated-parameter",
"no-deprecated-property": "no-deprecated-property",
"no-pseudo-modules": "no-pseudo-modules",
"no-globals": "no-globals",
"parsing-error": "parsing-error",
"no-deprecated-library": "no-deprecated-library",
"no-deprecated-component": "no-deprecated-component",
"csp-unsafe-inline-script": "csp-unsafe-inline-script",
} as const;

export enum LintMessageSeverity {
Expand Down Expand Up @@ -52,7 +52,7 @@ export const MESSAGE_INFO = {

[MESSAGE.COMPONENT_MISSING_ASYNC_INTERFACE]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-async-component-flags"],
ruleId: RULES["async-component-flags"],

message: () =>
`Component is not configured for asynchronous loading.`,
Expand All @@ -64,7 +64,7 @@ export const MESSAGE_INFO = {

[MESSAGE.COMPONENT_MISSING_MANIFEST_DECLARATION]: {
severity: LintMessageSeverity.Warning,
ruleId: RULES["ui5-linter-async-component-flags"],
ruleId: RULES["async-component-flags"],

message: () =>
`Component does not specify that it uses the descriptor via the manifest.json file`,
Expand All @@ -76,7 +76,7 @@ export const MESSAGE_INFO = {

[MESSAGE.COMPONENT_REDUNDANT_ASYNC_FLAG]: {
severity: LintMessageSeverity.Warning,
ruleId: RULES["ui5-linter-async-component-flags"],
ruleId: RULES["async-component-flags"],

message: ({asyncFlagLocation}: {asyncFlagLocation: string}) =>
`Component implements the sap.ui.core.IAsyncContentCreation interface. ` +
Expand All @@ -87,15 +87,15 @@ export const MESSAGE_INFO = {

[MESSAGE.CSP_UNSAFE_INLINE_SCRIPT]: {
severity: LintMessageSeverity.Warning,
ruleId: RULES["ui5-linter-csp-unsafe-inline-script"],
ruleId: RULES["csp-unsafe-inline-script"],

message: () => `Use of unsafe inline script`,
details: () => `{@link topic:fe1a6dba940e479fb7c3bc753f92b28c Content Security Policy}`,
},

[MESSAGE.DEPRECATED_API_ACCESS]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-api"],
ruleId: RULES["no-deprecated-api"],

message: ({apiName}: {apiName: string}) =>
`Use of deprecated API '${apiName}'`,
Expand All @@ -104,7 +104,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_CLASS]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-api"],
ruleId: RULES["no-deprecated-api"],

message: ({className}: {className: string}) =>
`Use of deprecated class '${className}'`,
Expand All @@ -113,7 +113,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_COMPONENT]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-component"],
ruleId: RULES["no-deprecated-component"],

message: ({componentName}: {componentName: string}) =>
`Use of deprecated component '${componentName}'`,
Expand All @@ -122,7 +122,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_FUNCTION_CALL]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-api"],
ruleId: RULES["no-deprecated-api"],

message: ({functionName, additionalMessage}: {functionName: string; additionalMessage: string}) =>
`Call to deprecated function '${functionName}'${additionalMessage ? ` ${additionalMessage}` : ""}`,
Expand All @@ -131,7 +131,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_LIBRARY]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-library"],
ruleId: RULES["no-deprecated-library"],

message: ({libraryName}: {libraryName: string}) =>
`Use of deprecated library '${libraryName}'`,
Expand All @@ -140,7 +140,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_MANIFEST_JS_RESOURCES]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-api"],
ruleId: RULES["no-deprecated-api"],

message: () =>
`Use of deprecated property 'sap.ui5/resources/js'`,
Expand All @@ -150,7 +150,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_MODULE_IMPORT]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-api"],
ruleId: RULES["no-deprecated-api"],

message: ({moduleName}: {moduleName: string}) =>
`Import of deprecated module '${moduleName}'`,
Expand All @@ -159,7 +159,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_PROPERTY_OF_CLASS]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-api"],
ruleId: RULES["no-deprecated-api"],

message: ({propertyName, className}: {propertyName: string; className: string}) =>
`Use of deprecated property '${propertyName}' of class '${className}'`,
Expand All @@ -168,7 +168,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_PROPERTY]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-property"],
ruleId: RULES["no-deprecated-property"],

message: ({propertyName}: {propertyName: string}) =>
`Use of deprecated property '${propertyName}'`,
Expand All @@ -177,15 +177,15 @@ export const MESSAGE_INFO = {

[MESSAGE.HTML_IN_XML]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-api"],
ruleId: RULES["no-deprecated-api"],

message: () => `Usage of native HTML in XML Views/Fragments is deprecated`,
details: () => `{@link topic:be54950cae1041f59d4aa97a6bade2d8 Using Native HTML in XML Views (deprecated)}`,
},

[MESSAGE.LIB_INIT_API_VERSION]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: ({libInitFunction}: {libInitFunction: string}) =>
`Call to ${libInitFunction}() must be declared with property {apiVersion: 2}`,
Expand All @@ -194,7 +194,7 @@ export const MESSAGE_INFO = {

[MESSAGE.NO_DIRECT_DATATYPE_ACCESS]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-pseudo-modules"],
ruleId: RULES["no-pseudo-modules"],

message: ({moduleName}: {moduleName: string}) =>
`Deprecated access to DataType pseudo module '${moduleName}'`,
Expand All @@ -204,7 +204,7 @@ export const MESSAGE_INFO = {

[MESSAGE.NO_DIRECT_ENUM_ACCESS]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-pseudo-modules"],
ruleId: RULES["no-pseudo-modules"],

message: ({moduleName}: {moduleName: string}) =>
`Deprecated access to enum pseudo module '${moduleName}'`,
Expand All @@ -214,7 +214,7 @@ export const MESSAGE_INFO = {

[MESSAGE.NO_GLOBALS]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-globals"],
ruleId: RULES["no-globals"],

message: ({variableName, namespace}: {variableName: string; namespace: string}) =>
`Access of global variable '${variableName}' (${namespace})`,
Expand All @@ -223,7 +223,7 @@ export const MESSAGE_INFO = {

[MESSAGE.PARTIALLY_DEPRECATED_PARAMETERS_GET]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: () =>
`Usage of deprecated variant of 'sap/ui/core/theming/Parameters.get'`,
Expand All @@ -232,7 +232,7 @@ export const MESSAGE_INFO = {

[MESSAGE.PARTIALLY_DEPRECATED_CREATE_COMPONENT]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: () =>
`Usage of deprecated value for parameter 'async' of 'sap/ui/core/Component#createComponent'`,
Expand All @@ -242,7 +242,7 @@ export const MESSAGE_INFO = {

[MESSAGE.PARTIALLY_DEPRECATED_ODATA_MODEL_V2_CREATE_ENTRY]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: () =>
`Usage of deprecated parameter 'batchGroupId' in 'sap/ui/model/odata/v2/ODataModel#createEntry'`,
Expand All @@ -252,7 +252,7 @@ export const MESSAGE_INFO = {

[MESSAGE.PARTIALLY_DEPRECATED_ODATA_MODEL_V2_CREATE_ENTRY_PROPERTIES_ARRAY]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: () =>
`Usage of deprecated value for parameter 'properties' in 'sap/ui/model/odata/v2/ODataModel#createEntry'`,
Expand All @@ -263,7 +263,7 @@ export const MESSAGE_INFO = {

[MESSAGE.PARTIALLY_DEPRECATED_JSON_MODEL_LOAD_DATA]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: ({paramName}: {paramName: string}) =>
`Usage of deprecated value for parameter '${paramName}' of 'sap/ui/model/json/JSONModel#loadData'`,
Expand All @@ -274,7 +274,7 @@ export const MESSAGE_INFO = {

[MESSAGE.PARTIALLY_DEPRECATED_MOBILE_INIT]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: ({paramName}: {paramName: string}) =>
`Usage of deprecated value for parameter '${paramName}' of 'sap/ui/util/Mobile#init'`,
Expand All @@ -285,7 +285,7 @@ export const MESSAGE_INFO = {

[MESSAGE.PARTIALLY_DEPRECATED_CORE_ROUTER]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: () =>
`Usage of deprecated value for parameter 'oConfig.async' of constructor 'sap/ui/core/Router'`,
Expand All @@ -296,7 +296,7 @@ export const MESSAGE_INFO = {

[MESSAGE.DEPRECATED_ODATA_MODEL_V4_SYNCHRONIZATION_MODE]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-parameter"],
ruleId: RULES["no-deprecated-parameter"],

message: ({modelName}: {modelName?: string}) =>
`Usage of deprecated parameter 'synchronizationMode' ` +
Expand All @@ -308,7 +308,7 @@ export const MESSAGE_INFO = {

[MESSAGE.PARSING_ERROR]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-parsing-error"],
ruleId: RULES["parsing-error"],
fatal: true,

message: ({message}: {message: string}) => message,
Expand All @@ -317,7 +317,7 @@ export const MESSAGE_INFO = {

[MESSAGE.SVG_IN_XML]: {
severity: LintMessageSeverity.Error,
ruleId: RULES["ui5-linter-no-deprecated-api"],
ruleId: RULES["no-deprecated-api"],

message: () => `Usage of SVG in XML Views/Fragments is deprecated`,
details: () => undefined,
Expand Down
2 changes: 1 addition & 1 deletion test/lib/formatter/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test.beforeEach((t) => {
t.context.lintResults = [{
filePath: "",
messages: [{
ruleId: "ui5-linter-no-deprecated-api",
ruleId: "no-deprecated-api",
severity: 2,
line: 5,
column: 1,
Expand Down
Loading

0 comments on commit 119b61a

Please sign in to comment.