Merge pull request #16174 from backstage/rugvip/rules
add @backstage/eslint-plugin
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference types="react" />
|
||||
|
||||
@@ -60,7 +60,7 @@ function createConfig(dir, extraConfig = {}) {
|
||||
'@spotify/eslint-config-typescript',
|
||||
'prettier',
|
||||
'plugin:jest/recommended',
|
||||
'plugin:monorepo/recommended',
|
||||
'plugin:@backstage/recommended',
|
||||
...(extraExtends ?? []),
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
@@ -88,32 +88,6 @@ function createConfig(dir, extraConfig = {}) {
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'no-undef': 'off',
|
||||
'import/newline-after-import': 'error',
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: dir
|
||||
? [
|
||||
`!${joinPath(dir, 'src/**')}`,
|
||||
joinPath(dir, 'src/**/*.test.*'),
|
||||
joinPath(dir, 'src/**/*.stories.*'),
|
||||
joinPath(dir, 'src/**/__testUtils__/**'),
|
||||
joinPath(dir, 'src/**/__mocks__/**'),
|
||||
joinPath(dir, 'src/setupTests.*'),
|
||||
]
|
||||
: [
|
||||
// Legacy config for packages that don't provide a dir
|
||||
'**/*.test.*',
|
||||
'**/*.stories.*',
|
||||
'**/__testUtils__/**',
|
||||
'**/__mocks__/**',
|
||||
'**/src/setupTests.*',
|
||||
'**/dev/**',
|
||||
],
|
||||
optionalDependencies: true,
|
||||
peerDependencies: true,
|
||||
bundledDependencies: true,
|
||||
},
|
||||
],
|
||||
'no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'error',
|
||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||
@@ -135,9 +109,6 @@ function createConfig(dir, extraConfig = {}) {
|
||||
...(restrictedSrcImports ?? []),
|
||||
],
|
||||
patterns: [
|
||||
// Avoid cross-package imports
|
||||
'**/../../**/*/src/**',
|
||||
'**/../../**/*/src',
|
||||
// Prevent imports of stories or tests
|
||||
'*.stories*',
|
||||
'*.test*',
|
||||
@@ -187,8 +158,6 @@ function createConfig(dir, extraConfig = {}) {
|
||||
...(restrictedImports ?? []),
|
||||
...(restrictedTestImports ?? []),
|
||||
],
|
||||
// Avoid cross-package imports
|
||||
patterns: ['**/../../**/*/src/**', '**/../../**/*/src'],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"@backstage/config": "workspace:^",
|
||||
"@backstage/config-loader": "workspace:^",
|
||||
"@backstage/errors": "workspace:^",
|
||||
"@backstage/eslint-plugin": "workspace:^",
|
||||
"@backstage/release-manifests": "workspace:^",
|
||||
"@backstage/types": "workspace:^",
|
||||
"@esbuild-kit/cjs-loader": "^2.4.1",
|
||||
@@ -78,7 +79,6 @@
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
"eslint-plugin-jest": "^27.0.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||
"eslint-plugin-monorepo": "^0.3.2",
|
||||
"eslint-plugin-react": "^7.28.0",
|
||||
"eslint-plugin-react-hooks": "^4.3.0",
|
||||
"eslint-webpack-plugin": "^3.1.1",
|
||||
|
||||
@@ -50,7 +50,7 @@ export async function buildTypeDefinitionsWorker(
|
||||
*/
|
||||
const {
|
||||
PackageJsonLookup,
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
} = require('@rushstack/node-core-library/lib/PackageJsonLookup');
|
||||
|
||||
const old = PackageJsonLookup.prototype.tryGetPackageJsonFilePathFor;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import mockFs from 'mock-fs';
|
||||
import { packageVersions, createPackageVersionProvider } from './version';
|
||||
import { Lockfile } from './versioning';
|
||||
// eslint-disable-next-line monorepo/no-internal-import
|
||||
import corePluginApiPkg from '@backstage/core-plugin-api/package.json';
|
||||
|
||||
describe('createPackageVersionProvider', () => {
|
||||
|
||||
@@ -19,7 +19,7 @@ import semver from 'semver';
|
||||
import { paths } from './paths';
|
||||
import { Lockfile } from './versioning';
|
||||
|
||||
/* eslint-disable monorepo/no-relative-import */
|
||||
/* eslint-disable @backstage/no-relative-monorepo-imports */
|
||||
|
||||
/*
|
||||
This is a list of all packages used by the templates. If dependencies are added or removed,
|
||||
|
||||
Reference in New Issue
Block a user