Skip to content

Commit 7479b16

Browse files
Merge pull request #402 from topcoder-platform/TCA-647_delete-prettier
TCA-647 Remove prettier and tslint -> TCA-499_eslint
2 parents afc052c + 6de9429 commit 7479b16

File tree

209 files changed

+1329
-2042
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+1329
-2042
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ save_cache_settings: &save_cache_settings
4141
paths:
4242
- node_modules
4343

44-
running_yarn_tslint: &running_yarn_tslint
45-
name: Running Yarn tslint
44+
running_yarn_eslint: &running_yarn_eslint
45+
name: Running Yarn eslint
4646
command: |
47-
yarn add tslint -g
47+
yarn add eslint -g
4848
yarn lint
4949
5050
running_yarn_build: &running_yarn_build
@@ -81,7 +81,7 @@ lint_steps: &lint_steps
8181
# Initialization.
8282
- checkout
8383
- setup_remote_docker
84-
- run: *running_yarn_tslint
84+
- run: *running_yarn_eslint
8585

8686
build_steps: &build_steps
8787
# Initialization.
@@ -239,4 +239,4 @@ workflows:
239239
- master
240240

241241
- test-dev:
242-
context : org-global
242+
context : org-global

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ yarn-error.log*
2929

3030
# Editors
3131
.editorconfig
32-
.prettierrc

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,12 @@ Each [Tool](#tools) can have its own setup requirements. Please see each tool's
190190
| `yarn start:<dev>` | Serve dev mode build with dev's personal config |
191191
| `yarn build` | Build dev mode build with the default config and outputs static files in /builds |
192192
| `yarn build:prod` | Build prod mode build with the prod config and outputs static files in /builds |
193-
| `yarn lint` | Run tslint against ts/x files and outputs report |
194-
| `yarn lint:fix` | Run tslint against ts/x files, fixes auto-fixable issues, and outputs report |
195-
| `yarn eslint` | Run eslint against js/x files and outputs report |
196-
| `yarn eslint:fix` | Run eslint against js/x files, fixes auto-fixable issues, and outputs report |
193+
| `yarn lint:ts` | Run eslint against ts/x files and outputs report |
194+
| `yarn lint:ts:fix` | Run eslint against ts/x files, fixes auto-fixable issues, and outputs report |
195+
| `yarn lint:js` | Run eslint against js/x files and outputs report |
196+
| `yarn lint:js:fix` | Run eslint against js/x files, fixes auto-fixable issues, and outputs report |
197+
| `yarn lint` | Run eslint against js/x and ts/x files and outputs report |
198+
| `yarn lint:fix` | Run eslint against js/x and ts/x files, fixes auto-fixable issues, and outputs report |
197199
| `yarn test` | Run unit tests, watching for changes and re-running per your specifications |
198200
| `yarn test:no-watch` | Run unit tests once, without watching for changes or re-running |
199201
| `yarn cy:run` | Run e2e tests once in local command with the site is running |
@@ -370,11 +372,11 @@ The PlatformRoute model has several useful options:
370372
## Linting
371373

372374
### Rules
373-
While [TSLint](https://palantir.github.io/tslint/) is technically deprecated in favor of [Typescript ESLint](https://typescript-eslint.io/), TSLint is still far better at linting Typescript files than ESLint. So, for the time being, TSLint will be the primary linter, but ESLint remains configured for JS/X files.
374375

375-
The following command will install TSLint globally:
376+
Javascript rules: [src/.eslintrc.js](src/.eslintrc.js)
377+
378+
Typescript rules: [src-ts/.eslintrc.js](src-ts/.eslintrc.js)
376379

377-
>% yarn global add tslint typescript
378380

379381
### Command Line
380382

@@ -386,9 +388,7 @@ The following command will install TSLint globally:
386388

387389
>% yarn lint:fix
388390
389-
OR
390-
391-
>% yarn eslint:fix
391+
See the [yarn commmands](#yarn-commands) for further options.
392392

393393
### VS Code
394394

@@ -411,16 +411,16 @@ The most useful feature is to automatically apply all lint rules any time you sa
411411
...
412412
"editor.formatOnSave": true,
413413
"editor.codeActionsOnSave": {
414-
"source.fixAll.tslint": true,
414+
"source.fixAll.eslint": true,
415415
},
416416
}
417417
```
418418
419-
#### TSLint Plugin
419+
#### ESLint Plugin
420420
421421
Created by Microsoft, this plugin will allow you to see lint errors in the Problems panel.
422422
423-
>**WARNING:** Other lint plugins can interfere with TSLint, so it is recommended that you uninstall/disable all other lint plugins (e.g. ESLint, Prettier, etc).
423+
>**WARNING:** Other lint plugins can interfere with ESLint, so it is recommended that you uninstall/disable all other lint plugins (e.g. TSLint, Prettier, etc).
424424
425425
## Styling
426426

cypress.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// tslint:disable-next-line: no-submodule-imports This is the way cypress does it
21
import task from '@cypress/code-coverage/task'
32
import { defineConfig } from 'cypress'
43

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
"lint:js:fix": "eslint -c ./src/.eslintrc.js 'src/**/*.{js,jsx}' --fix",
1414
"lint": "npm run lint:js && npm run lint:ts",
1515
"lint:fix": "npm run lint:js:fix && npm run lint:ts:fix",
16-
"prettier": "prettier ./src-ts/**/*.{ts,tsx} --check",
17-
"prettier:fix": "prettier ./src-ts/**/*.{ts,tsx} --write",
18-
"format:all": "npm run prettier:fix && npm run lint:fix",
1916
"test": "react-scripts test --watchAll",
2017
"test:no-watch": "react-scripts test --watchAll=false --passWithNoTests",
2118
"cy:run": "cypress run --reporter junit",
@@ -120,14 +117,14 @@
120117
"cypress": "^10.10.0",
121118
"eslint": "^8.25.0",
122119
"eslint-config-airbnb": "^19.0.4",
123-
"eslint-config-prettier": "^8.5.0",
124120
"eslint-config-react-app": "^7.0.1",
125121
"eslint-config-react-important-stuff": "^3.0.0",
126122
"eslint-import-resolver-typescript": "^3.2.5",
127123
"eslint-plugin-cypress": "^2.12.1",
128124
"eslint-plugin-import": "^2.25.3",
129125
"eslint-plugin-jsx-a11y": "^6.5.1",
130-
"eslint-plugin-prettier": "^4.2.1",
126+
"eslint-plugin-no-null": "^1.0.2",
127+
"eslint-plugin-ordered-imports": "^0.6.0",
131128
"eslint-plugin-react": "^7.28.0",
132129
"eslint-plugin-react-hooks": "^4.3.0",
133130
"file-loader": "^6.2.0",
@@ -140,15 +137,13 @@
140137
"nyc": "^15.1.0",
141138
"postcss-loader": "^4.0.4",
142139
"postcss-scss": "^3.0.2",
143-
"prettier": "^2.7.1",
144140
"pretty-quick": "^3.1.3",
145141
"resolve-url-loader": "^5.0.0",
146142
"sass-loader": "^13.1.0",
147143
"serve": "^14.0.1",
148144
"start-server-and-test": "^1.14.0",
149145
"style-loader": "^3.3.1",
150146
"systemjs-webpack-interop": "^2.3.7",
151-
"tslint": "^6.1.3",
152147
"webpack": "^4.41.2",
153148
"webpack-cli": "^4.10.0",
154149
"webpack-config-single-spa-react": "^4.0.3",

src-ts/.eslintrc.js

Lines changed: 81 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,65 @@ module.exports = {
88
'plugin:react/recommended',
99
'airbnb',
1010
'plugin:@typescript-eslint/recommended',
11-
'prettier'
11+
'plugin:ordered-imports/recommended'
1212
],
1313
parser: '@typescript-eslint/parser',
1414
parserOptions: {
1515
useJSXTextNode: true,
16-
project: "./tsconfig.json",
17-
tsconfigRootDir: ".",
16+
project: './tsconfig.json',
17+
tsconfigRootDir: '.',
1818
tsx: true,
1919
jsx: true,
2020
sourceType: 'module',
2121
},
2222
plugins: [
23-
'react',
2423
'@typescript-eslint',
25-
'react-hooks',
24+
'no-null',
25+
'ordered-imports',
26+
'react',
27+
'react-hooks'
2628
],
2729
settings: {
2830
react: {
29-
"version": "detect"
31+
'version': 'detect'
3032
},
31-
"import/resolver": {
33+
'import/resolver': {
3234
typescript: {},
3335
}
3436
},
3537
rules: {
36-
"@typescript-eslint/ban-types": [
37-
"error",
38+
'@typescript-eslint/ban-types': [
39+
'error',
3840
{
39-
"extendDefaults": true,
40-
"types": {
41-
"{}": false
41+
'extendDefaults': true,
42+
'types': {
43+
'{}': false
4244
}
4345
}
4446
],
4547
'@typescript-eslint/explicit-function-return-type': 'off',
4648
'@typescript-eslint/no-explicit-any': 'error',
4749
'@typescript-eslint/no-inferrable-types': 'off',
4850
'@typescript-eslint/no-shadow': 'error',
51+
'@typescript-eslint/no-unused-vars': 'error',
4952
'@typescript-eslint/strict-boolean-expressions': [
5053
'error',
5154
{
55+
allowAny: true,
5256
allowNullableBoolean: true,
5357
allowNullableObject: true,
5458
allowNullableNumber: true,
5559
allowNullableString: true
5660
}
5761
],
62+
'arrow-parens': [
63+
'error',
64+
'as-needed'
65+
],
66+
'complexity': [
67+
'error',
68+
7
69+
],
5870
'import/extensions': 'off',
5971
'import/prefer-default-export': 'off',
6072
'indent': [
@@ -64,10 +76,15 @@ module.exports = {
6476
SwitchCase: 1,
6577
},
6678
],
79+
'jsx-quotes': [
80+
'error',
81+
'prefer-single'
82+
],
6783
'jsx-a11y/tabindex-no-positive': [
6884
'warn'
6985
],
70-
'no-extra-boolean-cast': "off",
86+
'no-extra-boolean-cast': 'off',
87+
'no-null/no-null': 'error',
7188
'no-plusplus': [
7289
'error',
7390
{
@@ -87,7 +104,56 @@ module.exports = {
87104
functions: false,
88105
}
89106
],
90-
"padding-line-between-statements": [
107+
'object-curly-newline': 'off',
108+
'operator-linebreak': [
109+
'error',
110+
'before'
111+
],
112+
'ordered-imports/ordered-imports': [
113+
'error',
114+
{
115+
'symbols-first': true,
116+
'declaration-ordering': [
117+
'type', {
118+
ordering: [
119+
'namespace',
120+
'destructured',
121+
'default',
122+
'side-effect',
123+
],
124+
secondaryOrdering: [
125+
'name',
126+
'lowercase-last'
127+
],
128+
}
129+
],
130+
'specifier-ordering': 'case-insensitive',
131+
'group-ordering': [
132+
{
133+
name: 'project root',
134+
match: '^@',
135+
order: 20
136+
},
137+
{
138+
name: 'parent directories',
139+
match: '^\\.\\.',
140+
order: 30
141+
},
142+
{
143+
name: 'current directory',
144+
match: '^\\.',
145+
order: 40
146+
},
147+
{
148+
name: 'third-party',
149+
match: '.*',
150+
order: 10
151+
},
152+
],
153+
},
154+
],
155+
'padded-blocks': 'off',
156+
'padding-line-between-statements': [
91157
'error',
92158
{ blankLine: 'always', prev: 'directive', next: '*' },
93159
{ blankLine: 'any', prev: 'directive', next: 'directive' },
@@ -139,5 +205,6 @@ module.exports = {
139205
'error',
140206
'never',
141207
],
208+
'sort-keys': 'error'
142209
},
143210
};

src-ts/.prettierrc.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

src-ts/header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { FC } from 'react'
22

3-
import styles from './Header.module.scss'
43
import { Logo } from './logo'
54
import { ToolSelectors } from './tool-selectors'
65
import { UtilitySelectors } from './utility-selectors'
6+
import styles from './Header.module.scss'
77

88
const Header: FC<{}> = () => (
99
<div className={styles['header-wrap']}>

src-ts/header/tool-selectors/ToolSelectors.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ interface ToolSelectorsProps {
77
isWide: boolean
88
}
99

10-
const ToolSelectors: FC<ToolSelectorsProps> = (props: ToolSelectorsProps) => props.isWide ? <ToolSelectorsWide /> : <ToolSelectorsNarrow />
10+
const ToolSelectors: FC<ToolSelectorsProps>
11+
= (props: ToolSelectorsProps) => (props.isWide
12+
? <ToolSelectorsWide />
13+
: <ToolSelectorsNarrow />)
1114

1215
export default ToolSelectors

src-ts/header/tool-selectors/tool-selectors-narrow/ToolSelectorsNarrow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import classNames from 'classnames'
21
import { Dispatch, FC, SetStateAction, useContext, useState } from 'react'
2+
import classNames from 'classnames'
33

44
import { IconOutline, routeContext, RouteContextData } from '../../../lib'
55

src-ts/header/tool-selectors/tool-selectors-narrow/tool-selector-narrow/ToolSelectorNarrow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import classNames from 'classnames'
21
import { FC, useContext } from 'react'
32
import { Link, useLocation } from 'react-router-dom'
3+
import classNames from 'classnames'
44

55
import { IconOutline, PlatformRoute, routeContext, RouteContextData, routeIsActiveTool } from '../../../../lib'
66

src-ts/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import classNames from 'classnames'
21
import { FC, useContext } from 'react'
32
import { Link, useLocation } from 'react-router-dom'
3+
import classNames from 'classnames'
44

55
import {
66
PlatformRoute,
@@ -37,8 +37,9 @@ const ToolSelectorWide: FC<ToolSelectorWideProps> = (props: ToolSelectorWideProp
3737
<div className={classNames(
3838
styles[baseClass],
3939
styles[activeIndicatorClass],
40-
isLink ? styles['tool-selector-wide-is-link'] : undefined
41-
)}>
40+
isLink ? styles['tool-selector-wide-is-link'] : undefined,
41+
)}
42+
>
4243
<Link
4344
className='large-tab'
4445
tabIndex={-1}

src-ts/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import classNames from 'classnames'
21
import { FC, useContext } from 'react'
32
import { NavigateFunction, useNavigate } from 'react-router-dom'
3+
import classNames from 'classnames'
44

55
import {
66
authUrlLogout,

src-ts/lib/avatar/Avatar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import classNames from 'classnames'
21
import { FC } from 'react'
2+
import classNames from 'classnames'
33

44
import styles from './Avatar.module.scss'
55

0 commit comments

Comments
 (0)