cli: use new eslint plugin + fix issues
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -2,15 +2,6 @@ module.exports = {
|
||||
extends: [require.resolve('@backstage/cli/config/eslint.backend')],
|
||||
rules: {
|
||||
'no-console': 0,
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: true,
|
||||
optionalDependencies: false,
|
||||
peerDependencies: false,
|
||||
bundledDependencies: false,
|
||||
},
|
||||
],
|
||||
'jest/valid-expect': 'off',
|
||||
'jest/expect-expect': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
|
||||
@@ -7,15 +7,6 @@
|
||||
{
|
||||
"assertFunctionNames": ["expect", "cy.contains"]
|
||||
}
|
||||
],
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": true,
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": true,
|
||||
"bundledDependencies": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import {
|
||||
} from '@backstage/backend-plugin-api';
|
||||
|
||||
// Internal import of the type to avoid needing to export this.
|
||||
// eslint-disable-next-line monorepo/no-internal-import
|
||||
// eslint-disable-next-line @backstage/no-forbidden-package-imports
|
||||
import type { InternalSharedBackendEnvironment } from '@backstage/backend-plugin-api/src/wiring/createSharedEnvironment';
|
||||
|
||||
export const defaultServiceFactories = [
|
||||
|
||||
+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,11 +60,11 @@ function createConfig(dir, extraConfig = {}) {
|
||||
'@spotify/eslint-config-typescript',
|
||||
'prettier',
|
||||
'plugin:jest/recommended',
|
||||
'plugin:monorepo/recommended',
|
||||
'plugin:@backstage/recommended',
|
||||
...(extraExtends ?? []),
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['import', ...(plugins ?? [])],
|
||||
plugins: ['import', 'monorepo', ...(plugins ?? [])],
|
||||
env: {
|
||||
jest: true,
|
||||
...env,
|
||||
@@ -87,33 +87,8 @@ function createConfig(dir, extraConfig = {}) {
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'no-undef': 'off',
|
||||
'monorepo/no-relative-import': 'error',
|
||||
'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',
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -1,14 +1 @@
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
|
||||
rules: {
|
||||
'no-console': 0,
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: true,
|
||||
optionalDependencies: false,
|
||||
peerDependencies: false,
|
||||
bundledDependencies: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
"dependencies": {
|
||||
"@backstage/cli-common": "workspace:^",
|
||||
"chalk": "^4.0.0",
|
||||
"commander": "^9.1.0",
|
||||
"jscodeshift": "^0.14.0",
|
||||
"jscodeshift-add-imports": "^1.0.10"
|
||||
},
|
||||
@@ -42,7 +43,6 @@
|
||||
"@backstage/cli": "workspace:^",
|
||||
"@types/jscodeshift": "^0.11.0",
|
||||
"@types/node": "^16.11.26",
|
||||
"commander": "^9.1.0",
|
||||
"ts-node": "^10.0.0"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
|
||||
@@ -18,7 +18,7 @@ import React, { ReactNode } from 'react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { RealLogViewer } from './RealLogViewer';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
import copyToClipboard from 'copy-to-clipboard';
|
||||
|
||||
// Used by useCopyToClipboard
|
||||
|
||||
@@ -20,7 +20,7 @@ import { TestApiProvider, MockErrorApi } from '@backstage/test-utils';
|
||||
import { errorApiRef } from '@backstage/core-plugin-api';
|
||||
import { AnsiLine } from './AnsiProcessor';
|
||||
import { useLogViewerSelection } from './useLogViewerSelection';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
import copyToClipboard from 'copy-to-clipboard';
|
||||
|
||||
// Used by useCopyToClipboard
|
||||
|
||||
@@ -25,7 +25,7 @@ if (!isLocal || process.env.BACKSTAGE_E2E_CLI_TEST) {
|
||||
require('..');
|
||||
} else {
|
||||
// Only used for development, so should be a devDependency
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
require('ts-node').register({
|
||||
transpileOnly: true,
|
||||
project: path.resolve(__dirname, '../../../tsconfig.json'),
|
||||
|
||||
@@ -7,15 +7,6 @@
|
||||
{
|
||||
"assertFunctionNames": ["expect", "cy.contains"]
|
||||
}
|
||||
],
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": true,
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": true,
|
||||
"bundledDependencies": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1 @@
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
|
||||
rules: {
|
||||
'no-console': 0,
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: true,
|
||||
optionalDependencies: false,
|
||||
peerDependencies: false,
|
||||
bundledDependencies: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
|
||||
@@ -26,22 +26,24 @@
|
||||
"clean": "backstage-cli package clean"
|
||||
},
|
||||
"bin": "bin/e2e-test",
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "workspace:^",
|
||||
"dependencies": {
|
||||
"@backstage/cli-common": "workspace:^",
|
||||
"@backstage/errors": "workspace:^",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/puppeteer": "^5.4.4",
|
||||
"chalk": "^4.0.0",
|
||||
"commander": "^9.1.0",
|
||||
"cross-fetch": "^3.1.5",
|
||||
"fs-extra": "10.1.0",
|
||||
"handlebars": "^4.7.3",
|
||||
"nodemon": "^2.0.2",
|
||||
"pgtools": "^0.3.0",
|
||||
"puppeteer": "^17.0.0",
|
||||
"tree-kill": "^1.2.2",
|
||||
"tree-kill": "^1.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "workspace:^",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/puppeteer": "^5.4.4",
|
||||
"nodemon": "^2.0.2",
|
||||
"ts-node": "^10.0.0"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
|
||||
@@ -159,7 +159,7 @@ async function buildDistWorkspace(workspaceName: string, rootDir: string) {
|
||||
appendDeps(pkg);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-forbidden-package-imports
|
||||
appendDeps(require('@backstage/create-app/package.json'));
|
||||
|
||||
print(`Preparing workspace`);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import fs from 'fs';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
// Cba polluting root package.json, we'll have this
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
import chalk from 'chalk';
|
||||
import { getPackages, Package } from '@manypkg/get-packages';
|
||||
|
||||
|
||||
@@ -7,15 +7,6 @@
|
||||
{
|
||||
"assertFunctionNames": ["expect", "cy.contains"]
|
||||
}
|
||||
],
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": true,
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": true,
|
||||
"bundledDependencies": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,15 +7,6 @@
|
||||
{
|
||||
"assertFunctionNames": ["expect", "cy.contains", "cy.document"]
|
||||
}
|
||||
],
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": true,
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": true,
|
||||
"bundledDependencies": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
import {
|
||||
databaseFactory,
|
||||
discoveryFactory,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
import { createDevApp, EntityGridItem } from '@backstage/dev-utils';
|
||||
import { Grid } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
import '@testing-library/jest-dom';
|
||||
import 'cross-fetch/polyfill';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
// IMPORTANT: Remove the lines below to enable type checking and linting
|
||||
// @ts-nocheck
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
import {
|
||||
CostInsightsApi,
|
||||
|
||||
@@ -1,14 +1 @@
|
||||
module.exports = {
|
||||
extends: [require.resolve('@backstage/cli/config/eslint')],
|
||||
rules: {
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: true,
|
||||
optionalDependencies: true,
|
||||
peerDependencies: true,
|
||||
bundledDependencies: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
const path = require('path');
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
import {
|
||||
act,
|
||||
fireEvent,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
|
||||
@@ -56,7 +56,7 @@ async function listFiles(dir = '') {
|
||||
// caused by the script. In CI, we want to ensure vale linter is run.
|
||||
async function exitIfMissingVale() {
|
||||
try {
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line @backstage/no-undeclared-imports
|
||||
await require('command-exists')('vale');
|
||||
} catch (e) {
|
||||
if (process.env.CI) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
*
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
const _ = require('lodash');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
import { Octokit } from '@octokit/rest';
|
||||
import minimist from 'minimist';
|
||||
// Generated by GitHub workflow .github/workflows/snyk-github-issue-creator
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
const { resolve: resolvePath } = require('path');
|
||||
const { promises: fs } = require('fs');
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
const { resolve: resolvePath } = require('path');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
const { resolve: resolvePath, join: joinPath, dirname } = require('path');
|
||||
const fs = require('fs').promises;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
const { execFile: execFileCb } = require('child_process');
|
||||
const { resolve: resolvePath, dirname: dirnamePath } = require('path');
|
||||
|
||||
Reference in New Issue
Block a user