Merge remote-tracking branch 'origin/main' into feature/split-into-libs
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
"import/order": "warn",
|
||||
"local-rules/bad-type-import": "error",
|
||||
"local-rules/no-direct-api-import": "warn",
|
||||
"local-rules/prefer-import-aliases": "warn",
|
||||
"@typescript-eslint/no-non-null-assertion": "off"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "npx eslint",
|
||||
"command": "npx eslint src",
|
||||
"name": "Debug eslint",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
|
||||
@@ -64,5 +64,30 @@ module.exports = {
|
||||
};
|
||||
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
/** @type {import('eslint').Rule.RuleModule} */
|
||||
'prefer-import-aliases': {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
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";`'
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user