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
+1 -10
View File
@@ -1,10 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
overrides: [
{
files: ['**/*.ts?(x)'],
rules: {
'react/prop-types': 1,
},
},
],
});
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
-1
View File
@@ -1,6 +1,5 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: {
'react/prop-types': 0,
'jest/expect-expect': 0,
},
});
+6 -77
View File
@@ -1,82 +1,11 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: {
'react/prop-types': 0,
'jest/expect-expect': 0,
'no-restricted-imports': [
2,
{
paths: [
{
name: '@material-ui/core',
message: "Please import '@material-ui/core/...' instead.",
},
{
name: '@material-ui/icons',
message: "Please import '@material-ui/icons/<Icon>' instead.",
},
{
name: '@material-ui/icons/',
message: "Please import '@material-ui/icons/<Icon>' instead.",
},
'_http_agent',
'_http_client',
'_http_common',
'_http_incoming',
'_http_outgoing',
'_http_server',
'_stream_duplex',
'_stream_passthrough',
'_stream_readable',
'_stream_transform',
'_stream_wrap',
'_stream_writable',
'_tls_common',
'_tls_wrap',
'assert',
'async_hooks',
'buffer',
'child_process',
'cluster',
'console',
'constants',
'crypto',
'dgram',
'diagnostics_channel',
'dns',
'domain',
'events',
'fs',
'fs/promises',
'http',
'http2',
'https',
'inspector',
'module',
'net',
'os',
'path',
'perf_hooks',
'process',
'punycode',
'querystring',
'readline',
'repl',
'stream',
'string_decoder',
'sys',
'timers',
'tls',
'trace_events',
'tty',
'url',
'util',
'v8',
'vm',
'worker_threads',
'zlib',
],
patterns: ['**/../../**/*/src/**', '**/../../**/*/src'],
},
],
},
restrictedImports: [
{
name: '@material-ui/core',
message: "Please import '@material-ui/core/...' instead.",
},
],
});
+1 -6
View File
@@ -1,6 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
rules: {
'react/prop-types': 0,
'jest/expect-expect': 0,
},
});
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
+1 -10
View File
@@ -1,10 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
overrides: [
{
files: ['**/*.ts?(x)'],
rules: {
'no-restricted-imports': 0,
},
},
],
});
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
@@ -37,6 +37,7 @@ function findPreviewBundlePath(): string {
// This can be tested by running `yarn pack` and extracting the resulting tarball into a directory.
// Within the extracted directory, run `npm install --only=prod`.
// Once that's done you can test the CLI in any directory using `node <tmp-dir>/package <command>`.
// eslint-disable-next-line no-restricted-syntax
return findPaths(__dirname).resolveOwn('dist/embedded-app');
}
}
+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"]',
},
],
});