packages,plugins: tweak migrated lint configurations

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-03-07 14:53:26 +01:00
parent 09b37063f2
commit 72fa341eb5
7 changed files with 22 additions and 157 deletions
+12 -53
View File
@@ -1,59 +1,18 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
ignorePatterns: ['sample-templates/'],
rules: {
'no-console': 0,
'new-cap': [
'error',
{
capIsNew: false,
},
],
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'path',
importNames: ['resolve'],
message:
'Do not use path.resolve, use `resolveSafeChildPath` from `@backstage/backend-common` instead as it prevents security issues',
},
],
patterns: ['**/../../**/*/src/**', '**/../../**/*/src'],
},
],
'no-restricted-syntax': [
'error',
{
message:
'Default import from winston is not allowed, import `* as winston` instead.',
selector:
'ImportDeclaration[source.value="winston"] ImportDefaultSpecifier',
},
{
message:
"`__dirname` doesn't refer to the same dir in production builds, try `resolvePackagePath()` from `@backstage/backend-common` instead.",
selector: 'Identifier[name="__dirname"]',
},
{
message:
'Do not use path.resolve, use `resolveSafeChildPath` from `@backstage/backend-common` instead as it prevents security issues',
selector:
'MemberExpression[object.name="path"][property.name="resolve"]',
},
],
},
overrides: [
restrictedSrcImports: [
{
files: ['*.test.*', 'src/setupTests.*', 'dev/**'],
rules: {
'no-restricted-imports': [
2,
{
patterns: ['**/../../**/*/src/**', '**/../../**/*/src'],
},
],
},
name: 'path',
importNames: ['resolve'],
message:
'Do not use path.resolve, use `resolveSafeChildPath` from `@backstage/backend-common` instead as it prevents security issues',
},
],
restrictedSrcSyntax: [
{
message:
'Do not use path.resolve, use `resolveSafeChildPath` from `@backstage/backend-common` instead as it prevents security issues',
selector: 'MemberExpression[object.name="path"][property.name="resolve"]',
},
],
});