description:'Ensures that any API resources from the `@umbraco-cms/backend-api` module are not used directly. Instead you should use the `tryExecuteAndNotify` function from the `@umbraco-cms/resources` module.',
category:'Best Practices',
recommended:true
},
fixable:'code',
schema:[],
},
create:function(context){
return{
// If methods called on *Resource classes are not already wrapped with `await tryExecuteAndNotify()`, then we should suggest to wrap them.
description:'Ensures that the application does not rely on file system paths for imports. Instead, use import aliases or relative imports. This also solves a problem where GitHub fails on the test runner step.',
category:'Best Practices',
recommended:true
},
schema:[],
},
create:function(context){
return{
ImportDeclaration:function(node){
if(node.source.value.startsWith('src/')){
context.report({
node,
message:'Prefer using import aliases or relative imports instead of absolute imports. Example: `import { MyComponent } from "src/components/MyComponent";` should be `import { MyComponent } from "@components/MyComponent";`'