8000 prettier linting · jordanliu/coderoad-vscode@66d806b · GitHub
[go: up one dir, main page]

Skip to content

Commit 66d806b

Browse files
committed
prettier linting
1 parent 155735a commit 66d806b

File tree

33 files changed

+770
-772
lines changed
  • 33 files changed

    +770
    -772
    lines changed

    .vscode/settings.json

    Lines changed: 1 addition & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -29,8 +29,7 @@
    2929
    },
    3030
    "search.exclude": {
    3131
    "out": true // set this to false to include "out" folder in search results
    32-
    },
    33-
    "prettier.eslintIntegration": true,
    32+
    },
    3433

    3534
    // styles
    3635
    "editor.formatOnSave": true,

    web-app/.eslintrc.js

    Lines changed: 59 additions & 59 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,61 +1,61 @@
    11
    module.exports = {
    2-
    parser: 'typescript-eslint-parser',
    3-
    // extends: [
    4-
    // 'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
    5-
    // 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
    6-
    // 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
    7-
    // '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.
    8-
    // ],
    9-
    parserOptions: {
    10-
    ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
    11-
    sourceType: 'module', // Allows for the use of imports
    12-
    ecmaFeatures: {
    13-
    jsx: true, // Allows for the parsing of JSX
    14-
    useJSXTextNode: true,
    15-
    },
    16-
    },
    17-
    rules: {
    18-
    // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
    19-
    // e.g.
    20-
    'arrow-parens': 0,
    21-
    'comma-dangle': 0,
    22-
    'global-require': 0,
    23-
    'import/no-extraneous-dependencies': 0,
    24-
    'import/no-named-as-default': 0,
    25-
    'import/prefer-default-export': 0,
    26-
    'jsx-a11y/href-no-hash': 0,
    27-
    quotes: ['error', 'single'],
    28-
    'no-tabs': 0,
    29-
    'react/jsx-curly-spacing': 0,
    30-
    'react/jsx-indent-props': 'off',
    31-
    'react/prop-types': 0,
    32-
    'react/sort-comp': 0,
    33-
    'react/prefer-stateless-function': 0,
    34-
    semi: ['error', 'never'],
    35-
    'object-curly-newline': 0,
    36-
    'react/jsx-indent': 'off',
    37-
    'class-methods-use-this': 0,
    38-
    indent: 'off',
    39-
    'implicit-arrow-linebreak': 'off',
    40-
    'function-paren-newline': 'off',
    41-
    'lines-between-class-members': 'off',
    42-
    'no-unreachable': 'off',
    43-
    'import/no-unresolved': 'off',
    44-
    'no-unused-vars': 'off',
    45-
    'no-confusing-arrow': 'off',
    46-
    'no-restricted-syntax': 'off',
    47-
    'react/jsx-one-expression-per-line': 'off',
    48-
    'guard-for-in': 'off',
    49-
    'no-nested-ternary': 'off',
    50-
    'no-underscore-dangle': 'off',
    51-
    'react/destructuring-assignment': 'off',
    52-
    'no-return-assign': 'off',
    53-
    'no-case-declarations': 'off',
    54-
    'react/no-array-index-key': 'off',
    55-
    },
    56-
    settings: {
    57-
    react: {
    58-
    version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
    59-
    },
    60-
    },
    2+
    parser: 'typescript-eslint-parser',
    3+
    extends: [
    4+
    // 'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
    5+
    // 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
    6+
    // 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
    7+
    // '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.
    8+
    ],
    9+
    parserOptions: {
    10+
    ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
    11+
    sourceType: 'module', // Allows for the use of imports
    12+
    ecmaFeatures: {
    13+
    jsx: true, // Allows for the parsing of JSX
    14+
    useJSXTextNode: true,
    15+
    },
    16+
    },
    17+
    rules: {
    18+
    // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
    19+
    // e.g.
    20+
    'arrow-parens': 0,
    21+
    'comma-dangles': 0,
    22+
    'global-require': 0,
    23+
    'import/no-extraneous-dependencies': 0,
    24+
    'import/no-named-as-default': 0,
    25+
    'import/prefer-default-export': 0,
    26+
    'jsx-a11y/href-no-hash': 0,
    27+
    quotes: ['error', 'single'],
    28+
    'no-tabs': 0,
    29+
    'react/jsx-curly-spacing': 0,
    30+
    'react/jsx-indent-props': 'off',
    31+
    'react/prop-types': 0,
    32+
    'react/sort-comp': 0,
    33+
    'react/prefer-stateless-function': 0,
    34+
    semi: ['error', 'never'],
    35+
    'object-curly-newline': 0,
    36+
    'react/jsx-indent': 'off',
    37+
    'class-methods-use-this': 0,
    38+
    indent: 'off',
    39+
    'implicit-arrow-linebreak': 'off',
    40+
    'function-paren-newline': 'off',
    41+
    'lines-between-class-members': 'off',
    42+
    'no-unreachable': 'off',
    43+
    'import/no-unresolved': 'off',
    44+
    'no-unused-vars': 'off',
    45+
    'no-confusing-arrow': 'off',
    46+
    'no-restricted-syntax': 'off',
    47+
    'react/jsx-one-expression-per-line': 'off',
    48+
    'guard-for-in': 'off',
    49+
    'no-nested-ternary': 'off',
    50+
    'no-underscore-dangle': 'off',
    51+
    'react/destructuring-assignment': 'off',
    52+
    'no-return-assign': 'off',
    53+
    'no-case-declarations': 'off',
    54+
    'react/no-array-index-key': 'off',
    55+
    },
    56+
    settings: {
    57+
    react: {
    58+
    version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
    59+
    },
    60+
    },
    6161
    }

    web-app/.prettierrc.js

    Lines changed: 5 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,7 +1,7 @@
    11
    module.exports = {
    2-
    printWidth: 120,
    3-
    semi: false,
    4-
    singleQuote: true,
    5-
    tabWidth: 2,
    6-
    trailingComma: 'all',
    2+
    printWidth: 120,
    3+
    semi: false,
    4+
    singleQuote: true,
    5+
    tabWidth: 2,
    6+
    trailingComma: 'all',
    77
    }

    web-app/src/App.tsx

    Lines changed: 5 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,13 +5,12 @@ import ErrorBoundary from './components/ErrorBoundary'
    55
    import client from './services/apollo'
    66
    import Routes from './Routes'
    77

    8-
    98
    const App = () => (
    10-
    <ErrorBoundary>
    11-
    <ApolloProvider client={client}>
    12-
    <Routes />
    13-
    </ApolloProvider>
    14-
    </ErrorBoundary>
    9+
    <ErrorBoundary>
    10+
    <ApolloProvider client={client}>
    11+
    <Routes />
    12+
    </ApolloProvider>
    13+
    </ErrorBoundary>
    1514
    )
    1615

    1716
    export default App

    web-app/src/Routes.tsx

    Lines changed: 30 additions & 30 deletions
    Original file line numberDiff line numberDiff line change
    @@ -15,36 +15,36 @@ const { Route } = Router
    1515
    const tempSend = (action: any) => console.log('sent')
    1616

    1717
    const Routes = () => {
    18-
    return (
    19-
    <Workspace>
    20-
    <Router>
    21-
    <Route path={['Start.Startup', 'Start.Authenticate', 'Start.NewOrContinue']}>
    22-
    <LoadingPage text="Launching..." />
    23-
    </Route>
    24-
    <Route path="Start.SelectTutorial">
    25-
    <NewPage send={tempSend} />
    26-
    </Route>
    27-
    <Route path="Start.ContinueTutorial">
    28-
    <ContinuePage send={tempSend} context={{} as CR.MachineContext} />
    29-
    </Route>
    30-
    <Route path="Tutorial.Initialize">
    31-
    <LoadingPage text="Initializing..." />
    32-
    </Route>
    33-
    <Route path="Tutorial.LoadNext">
    34-
    <LoadingPage text="Loading..." />
    35-
    </Route>
    36-
    <Route path="Tutorial.Summary">
    37-
    <OverviewPage send={tempSend} context={{} as CR.MachineContext} />
    38-
    </Route>
    39-
    <Route path="Tutorial.Level">
    40-
    <LevelSummaryPage send={tempSend} context={{} as CR.MachineContext} />
    41-
    </Route>
    42-
    <Route path="Tutorial.Completed">
    43-
    <CompletedPage send={tempSend} context={{} as CR.MachineContext} />
    44-
    </Route>
    45-
    </Router>
    46-
    </Workspace>
    47-
    )
    18+
    return (
    19+
    <Workspace>
    20+
    <Router>
    21+
    <Route path={['Start.Startup', 'Start.Authenticate', 'Start.NewOrContinue']}>
    22+
    <LoadingPage text="Launching..." />
    23+
    </Route>
    24+
    <Route path="Start.SelectTutorial">
    25+
    <NewPage send={tempSend} />
    26+
    </Route>
    27+
    <Route path="Start.ContinueTutorial">
    28+
    <ContinuePage send={tempSend} context={{} as CR.MachineContext} />
    29+
    </Route>
    30+
    <Route path="Tutorial.Initialize">
    31+
    <LoadingPage text="Initializing..." />
    32+
    </Route>
    33+
    <Route path="Tutorial.LoadNext">
    34+
    <LoadingPage text="Loading..." />
    35+
    </Route>
    36+
    <Route path="Tutorial.Summary">
    37+
    <OverviewPage send={tempSend} context={{} as CR.MachineContext} />
    38+
    </Route>
    39+
    <Route path="Tutorial.Level">
    40+
    <LevelSummaryPage send={tempSend} context={{} as CR.MachineContext} />
    41+
    </Route>
    42+
    <Route path="Tutorial.Completed">
    43+
    <CompletedPage send={tempSend} context={{} as CR.MachineContext} />
    44+
    </Route>
    45+
    </Router>
    46+
    </Workspace>
    47+
    )
    4848
    }
    4949

    5050
    export default Routes

    web-app/src/components/Button/index.tsx

    Lines changed: 8 additions & 8 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2,17 +2,17 @@ import * as React from 'react'
    22
    import { Button as AlifdButton } from '@alifd/next'
    33

    44
    interface Props {
    5-
    style?: React.CSSProperties
    6-
    children: string | React.ReactNode
    7-
    disabled?: boolean
    8-
    type?: 'primary' | 'secondary' | 'normal'
    9-
    onClick?: () => void
    5+
    style?: React.CSSProperties
    6+
    children: string | React.ReactNode
    7+
    disabled?: boolean
    8+
    type?: 'primary' | 'secondary' | 'normal'
    9+
    onClick?: () => void
    1010
    }
    1111

    1212
    const Button = (props: Props) => (
    13-
    <AlifdButton onClick={props.onClick} type={props.type} disabled={props.disabled} style={props.style}>
    14-
    {props.children}
    15-
    </AlifdButton>
    13+
    <AlifdButton onClick={props.onClick} type={props.type} disabled={props.disabled} style={props.style}>
    14+
    {props.children}
    15+
    </AlifdButton>
    1616
    )
    1717

    1818
    export default Button

    web-app/src/components/Card/index.tsx

    Lines changed: 15 additions & 15 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2,27 +2,27 @@ import * as React from 'react'
    22
    import { Card as AlifdCard } from '@alifd/next'
    33

    44
    const styles = {
    5-
    card: {
    6-
    display: 'flex',
    7-
    width: '100%',
    8-
    },
    5+
    card: {
    6+
    display: 'flex',
    7+
    width: '100%',
    8+
    },
    99
    }
    1010

    1111
    interface Props {
    12-
    children: React.ReactNode
    13-
    onClick?: () => void
    14-
    style?: React.CSSProperties
    12+
    children: React.ReactNode
    13+
    onClick?: () => void
    14+
    style?: React.CSSProperties
    1515
    }
    1616

    1717
    const Card = (props: Props) => (
    18-
    <AlifdCard
    19-
    showTitleBullet={false}
    20-
    contentHeight="auto"
    21-
    onClick={props.onClick}
    22-
    style={{ ...styles.card, ...props.style }}
    23-
    >
    24-
    {props.children}
    25-
    </AlifdCard>
    18+
    <AlifdCard
    19+
    showTitleBullet={false}
    20+
    contentHeight="auto"
    21+
    onClick={props.onClick}
    22+
    style={{ ...styles.card, ...props.style }}
    23+
    >
    24+
    {props.children}
    25+
    </AlifdCard>
    2626
    )
    2727

    2828
    export default Card
    Lines changed: 22 additions & 22 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,34 +1,34 @@
    11
    import * as React from 'react'
    22

    33
    const styles = {
    4-
    box: {
    5-
    display: 'flex',
    6-
    alignItems: 'center',
    7-
    justifyContent: 'center',
    8-
    },
    9-
    input: {
    10-
    border: '1px solid black',
    11-
    backgroundColor: 'yellow',
    12-
    },
    4+
    box: {
    5+
    display: 'flex',
    6+
    alignItems: 'center',
    7+
    justifyContent: 'center',
    8+
    },
    9+
    input: {
    10+
    border: '1px solid black',
    11+
    backgroundColor: 'yellow',
    12+
    },
    1313
    }
    1414

    1515
    interface Props {
    16-
    status: 'COMPLETE' | 'INCOMPLETE' | 'ACTIVE' | 'LOADING'
    16+
    status: 'COMPLETE' | 'INCOMPLETE' | 'ACTIVE' | 'LOADING'
    1717
    }
    1818

    1919
    const Checkbox = (props: Props) => {
    20-
    const checked = props.status === 'COMPLETE'
    21-
    // const loading = props.state === 'LOADING'
    22-
    const onChange = () => {
    23-
    /* read */
    24-
    }
    25-
    return (
    26-
    <div style={styles.box}>
    27-
    <label>
    28-
    <input style={styles.input} type="checkbox" checked={checked} onChange={onChange} />
    29-
    </label>
    30-
    </div>
    31-
    )
    20+
    const checked = props.status === 'COMPLETE'
    21+
    // const loading = props.state === 'LOADING'
    22+
    const onChange = () => {
    23+
    /* read */
    24+
    }
    25+
    return (
    26+
    <div style={styles.box}>
    27+
    <label>
    28+
    <input style={styles.input} type="checkbox" checked={checked} onChange={onChange} />
    29+
    </label>
    30+
    </div>
    31+
    )
    3232
    }
    3333

    3434
    export default Checkbox

    web-app/src/components/Debugger/debuggerWrapper.tsx

    Lines changed: 8 additions & 8 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,14 +5,14 @@ import stateToString from './stateToString'
    55
    const SHOW_DEBUGGER = JSON.parse(process.env.REACT_APP_DEBUG || 'false')
    66

    77
    const debuggerWrapper = (element: React.ReactElement, state: any) => {
    8-
    if (SHOW_DEBUGGER) {
    9-
    return (
    10-
    <Debugger state={stateToString(state.value)} {...state.context}>
    11-
    {element}
    12-
    </Debugger>
    13-
    )
    14-
    }
    15-
    return element
    8+
    if (SHOW_DEBUGGER) {
    9+
    return (
    10+
    <Debugger state={stateToString(state.value)} {...state.context}>
    11+
    {element}
    12+
    </Debugger>
    13+
    )
    14+
    }
    15+
    return element
    1616
    }
    1717

    1818
    export default debuggerWrapper

    0 commit comments

    Comments
     (0)
    0