Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions frontend/packages/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
module.exports = {
root: true,
extends: [
'plugin:console/react',
'plugin:console/typescript',
// TODO enable when we stop using jest with jasmine types
// 'plugin:console/jest',
'plugin:console/prettier',
'plugin:console/react-typescript-prettier',
],
rules: {
'no-restricted-imports': [
Expand All @@ -15,7 +11,5 @@ module.exports = {
message: 'Use lodash instead. webpack is configured to use lodash-es automatically.',
},
],
// TODO fix for monorepo support
'import/no-extraneous-dependencies': 'off',
},
};
6 changes: 6 additions & 0 deletions frontend/packages/console-plugin-sdk/src/codegen/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
root: true,
extends: [
'plugin:console/node-typescript-prettier',
],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-env node */

import { Extension, Plugin, ActivePlugin } from '../typings';
import { PluginPackage } from './plugin-resolver';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-env node */

import * as path from 'path';
import * as _ from 'lodash';
import * as glob from 'glob';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env node */
/* eslint-disable no-console */

import chalk from 'chalk';
Expand Down
9 changes: 8 additions & 1 deletion frontend/packages/eslint-plugin-console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ OpenShift Console's ESLint rules and configs.

When extending multiple configurations, add to the list following the order outlined below:

| Plugin | Description | Type |
| Config | Description | Type |
| ---------------- | ---------------------------------------------------------------------------------------------------- | -------- |
| base | JavaScript lint rule set | core |
| react | React lint rule set | core |
Expand All @@ -21,6 +21,13 @@ When extending multiple configurations, add to the list following the order outl
- Choose one or more `extra`.
- Choose to include `prettier` or not. This must go last.

Alternatively, use one of the pre-composed configurations representing common code archetypes (choose one):

| Config | Description |
| ------------------------- | ---------------------------------------------- |
| react-typescript-prettier | Common web preset: React, TypeScript, Prettier |
| node-typescript-prettier | Common Node.js preset: TypeScript, Prettier |

## Examples

By default, ESLint will look for configuration files in all parent folders up to the root directory.
Expand Down
37 changes: 35 additions & 2 deletions frontend/packages/eslint-plugin-console/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
rules: {},
configs: {
// When extending multiple configuratioons, add to the list following the order outlined below:
// When extending multiple configurations, add to the list following the order outlined below:

// Core configs: choose one
base: require('./lib/config/base'),
Expand All @@ -15,7 +15,40 @@ module.exports = {
jest: require('./lib/config/jest'),
node: require('./lib/config/node'),

// Prettier must go last
// Prettier must go last (optional)
prettier: require('./lib/config/prettier'),

// ...or use the pre-composed configurations representing common code archetypes (choose one):

// Common web preset: React, TypeScript, Prettier
'react-typescript-prettier': {
extends: [
'plugin:console/react',
'plugin:console/typescript',
// TODO enable when we stop using jest with jasmine types
// 'plugin:console/jest',
'plugin:console/prettier',
],
rules: {
// TODO fix for monorepo support
'import/no-extraneous-dependencies': 'off',
},
},

// Common Node.js preset: TypeScript, Prettier
'node-typescript-prettier': {
extends: [
'plugin:console/base',
'plugin:console/typescript',
'plugin:console/node',
// TODO enable when we stop using jest with jasmine types
// 'plugin:console/jest',
'plugin:console/prettier',
],
rules: {
// TODO fix for monorepo support
'import/no-extraneous-dependencies': 'off',
},
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
root: true,
extends: [
'plugin:console/node-typescript-prettier',
],
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-nested-callbacks */
import { OrderedMap } from 'immutable';
import * as _ from 'lodash';
import { testName } from '../../../../integration-tests/protractor.conf';
Expand All @@ -10,7 +9,6 @@ import {
} from '../../../console-shared/src/test-utils/utils';
import { statusIcons } from '../views/virtualMachine.view';
import { VirtualMachine } from './models/virtualMachine';
// eslint-disable-next-line no-unused-vars
import { getResourceObject } from './utils/utils';
import { VM_BOOTUP_TIMEOUT_SECS, CLONE_VM_TIMEOUT_SECS } from './utils/consts';
import {
Expand Down