Skip to content

Commit

Permalink
[@dagster-io/eslint-config] Create shared config (#7328)
Browse files Browse the repository at this point in the history
  • Loading branch information
hellendag committed Apr 8, 2022
1 parent 4cb70cc commit a515c58
Show file tree
Hide file tree
Showing 35 changed files with 309 additions and 453 deletions.
85 changes: 1 addition & 84 deletions js_modules/dagit/packages/app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,86 +1,3 @@
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
plugins: ['react-hooks', 'import'],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
rules: {
curly: 'error',
eqeqeq: 'error',
'import/no-cycle': 'error',
'import/no-default-export': 'error',
'import/no-duplicates': 'error',
'import/order': [
'error',
{
alphabetize: {order: 'asc', caseInsensitive: false},
'newlines-between': 'always',
},
],
'no-restricted-imports': [
'error',
{
patterns: ['!styled-components/macro'],
paths: [
{
name: '@blueprintjs/core',
importNames: ['Alert', 'Callout', 'Spinner'],
message: 'Please use components in src/ui instead.',
},
{
name: '@blueprintjs/core',
importNames: ['Tooltip'],
message: 'Please use `Tooltip2` in `@blueprintjs/popover2` instead.',
},
{
name: 'styled-components',
message: 'Please import from `styled-components/macro`.',
},
{
name: 'react-router',
message: 'Please import from `react-router-dom`.',
},
],
},
],
'react/jsx-curly-brace-presence': 'error',
'react/jsx-no-target-blank': 'error',
'react/prefer-stateless-function': 'error',
'react/prop-types': 'off',
'react/display-name': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true},
],
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/prefer-interface': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
extends: ['@dagster-io/eslint-config'],
};
13 changes: 2 additions & 11 deletions js_modules/dagit/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"web-vitals": "^2.1.3"
},
"devDependencies": {
"@dagster-io/eslint-config": "workspace:*",
"@dagster-io/react-scripts": "5.0.1",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
Expand All @@ -28,18 +29,8 @@
"@types/react": "17.0.4",
"@types/react-dom": "^17.0.11",
"eslint": "8.7.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-react-app": "^7.0.0",
"eslint-plugin-graphql": "^4.0.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jest": "25.3.0",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "7.27.1",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-storybook": "^0.5.3",
"eslint-plugin-testing-library": "5.0.1",
"eslint-webpack-plugin": "3.1.1",
"prettier": "2.2.1",
"typescript": "^4.5.4"
},
"scripts": {
Expand Down
136 changes: 3 additions & 133 deletions js_modules/dagit/packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,13 @@ const path = require('path');

const schemaPath = path.resolve(path.join(__dirname, 'src', 'graphql', 'schema.graphql'));
const schema = fs.readFileSync(schemaPath).toString();

module.exports = {
parser: '@typescript-eslint/parser',
// Specifies the ESLint parser
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:storybook/recommended',
'plugin:prettier/recommended', // Prettier plugin must be last!
'plugin:storybook/recommended', '@dagster-io/eslint-config',
],
plugins: ['react-hooks', 'import', 'graphql'],
parserOptions: {
ecmaVersion: 2018,
// Allows for the parsing of modern ECMAScript features
sourceType: 'module',
// Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
plugins: ['graphql'],
rules: {
curly: 'error',
eqeqeq: [
'error',
'always',
{
null: 'ignore',
},
],
'graphql/required-fields': [
'error',
{
Expand All @@ -40,113 +18,5 @@ module.exports = {
requiredFields: ['id'],
},
],
'import/no-cycle': 'error',
'import/no-default-export': 'error',
'import/no-duplicates': 'error',
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
'newlines-between': 'always',
},
],
'no-alert': 'error',
'no-restricted-imports': [
'error',
{
patterns: ['!styled-components/macro'],
paths: [
{
name: '@blueprintjs/core',
importNames: [
'Alert',
'Button',
'ButtonGroup',
'Callout',
'Checkbox',
'Colors',
'Dialog',
'Icon',
'InputGroup',
'Menu',
'MenuDivider',
'MenuItem',
'NonIdealState',
'Popover',
'Select',
'Suggest',
'Spinner',
'Switch',
'Tab',
'Tabs',
'Tag',
'Toast',
'Toaster',
'Tooltip',
],
message: 'Please use components in src/ui instead.',
},
{
name: '@blueprintjs/popover2',
importNames: ['Popover2', 'Tooltip2'],
message: 'Please use components in src/ui instead.',
},
{
name: '@blueprintjs/select',
message: 'Please use components in src/ui instead.',
},
{
name: 'graphql-tag',
message: 'Please import from `@apollo/client`.',
},
{
name: 'graphql.macro',
importNames: ['gql'],
message: 'Please import from `@apollo/client`.',
},
{
name: 'styled-components',
message: 'Please import from `styled-components/macro`.',
},
],
},
],
'react/jsx-curly-brace-presence': 'error',
'react/jsx-no-target-blank': 'error',
'react/prefer-stateless-function': 'error',
'react/prop-types': 'off',
'react/display-name': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/prefer-interface': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
settings: {
'import/internal-regex': '^src/',
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
};
12 changes: 2 additions & 10 deletions js_modules/dagit/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"@blueprintjs/core": "^3.45.0",
"@blueprintjs/popover2": "0.10.1",
"@blueprintjs/select": "^3.16.4",
"@dagster-io/ui": "1.0.0",
"@dagster-io/eslint-config": "workspace:*",
"@dagster-io/ui": "workspace:*",
"@graphql-tools/mock": "^8.5.0",
"@graphql-tools/schema": "^8.3.1",
"@mdx-js/react": "^1.6.22",
Expand Down Expand Up @@ -111,22 +112,13 @@
"@types/styled-components": "^5.1.9",
"@types/testing-library__jest-dom": "^5.14.2",
"@types/ws": "^6.0.3",
"@typescript-eslint/eslint-plugin": "5.8.0",
"@typescript-eslint/parser": "5.8.0",
"apollo": "^2.33.1",
"babel-jest": "^26.6.3",
"babel-loader": "8.2.2",
"babel-plugin-graphql-tag": "^2.5.0",
"babel-plugin-macros": "^2.8.0",
"child-process": "^1.0.2",
"eslint": "8.5.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-graphql": "^4.0.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "7.27.1",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-storybook": "^0.5.5",
"faker": "5.5.3",
"graphql.macro": "^1.4.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-restricted-imports
import {BreadcrumbProps, Breadcrumbs} from '@blueprintjs/core';
import {Box, Colors, PageHeader, Heading} from '@dagster-io/ui';
import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {gql, useQuery} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {HTMLInputProps, InputGroupProps2, Intent} from '@blueprintjs/core';
import {
Box,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {gql} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {Intent} from '@blueprintjs/core';
import {
Box,
Expand Down
7 changes: 1 addition & 6 deletions js_modules/dagit/packages/core/src/nav/PipelineNav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {IconName} from '@blueprintjs/core';
import {Box, PageHeader, Tabs, Tag, Heading, Tooltip} from '@dagster-io/ui';
import React from 'react';
import {useRouteMatch} from 'react-router-dom';
Expand All @@ -20,27 +19,23 @@ import {RepositoryLink} from './RepositoryLink';
interface TabConfig {
title: string;
pathComponent: string;
icon: IconName;
isAvailable?: (permissions: PermissionsMap) => boolean;
}

const pipelineTabs: {[key: string]: TabConfig} = {
overview: {title: 'Overview', pathComponent: '', icon: 'dashboard'},
overview: {title: 'Overview', pathComponent: ''},
playground: {
title: 'Launchpad',
pathComponent: 'playground',
icon: 'manually-entered-data',
isAvailable: (permissions: PermissionsMap) => permissions.canLaunchPipelineExecution,
},
runs: {
title: 'Runs',
pathComponent: 'runs',
icon: 'history',
},
partitions: {
title: 'Partitions',
pathComponent: 'partitions',
icon: 'multi-select',
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {gql, useApolloClient, useMutation, useQuery} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {Intent} from '@blueprintjs/core';
import * as React from 'react';

Expand Down
1 change: 1 addition & 0 deletions js_modules/dagit/packages/core/src/ops/OpTypeSignature.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {gql} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {Code} from '@blueprintjs/core';
import {Colors, FontFamily} from '@dagster-io/ui';
import * as React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-restricted-imports
import {Intent} from '@blueprintjs/core';
import {MultiSlider} from '@dagster-io/ui';
import moment from 'moment-timezone';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {gql} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {Breadcrumbs} from '@blueprintjs/core';
import {Checkbox, Colors, SplitPanelContainer, TextInput} from '@dagster-io/ui';
import Color from 'color';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-restricted-imports
import {Collapse} from '@blueprintjs/core';
import {Colors, Icon, FontFamily} from '@dagster-io/ui';
import * as React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-restricted-imports
import {Text} from '@blueprintjs/core';
import {Colors, Group, Icon, IconWrapper, Code, FontFamily} from '@dagster-io/ui';
import * as React from 'react';
Expand Down
1 change: 1 addition & 0 deletions js_modules/dagit/packages/core/src/runs/DeletionDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {useMutation} from '@apollo/client';
// eslint-disable-next-line no-restricted-imports
import {ProgressBar} from '@blueprintjs/core';
import {Button, Colors, DialogBody, DialogFooter, Dialog, Group, Icon, Mono} from '@dagster-io/ui';
import * as React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-restricted-imports
import {Intent} from '@blueprintjs/core';
import {Box, Colors, Tag} from '@dagster-io/ui';
import qs from 'qs';
Expand Down

1 comment on commit a515c58

@vercel
Copy link

@vercel vercel bot commented on a515c58 Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dagit-storybook – ./js_modules/dagit/packages/ui

dagit-storybook-elementl.vercel.app
dagit-storybook.vercel.app
dagit-storybook-git-master-elementl.vercel.app

Please sign in to comment.