Skip to content

Commit a0d5290

Browse files
Use "dprint" as a code formatter, replacing eslint (#2997)
1 parent 4980c7a commit a0d5290

File tree

1,164 files changed

+18306
-13072
lines changed

Some content is hidden

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

1,164 files changed

+18306
-13072
lines changed

.eslintignore

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

.eslintrc.js

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

.github/pull_request_template.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ Design decisions and their rationales should be documented in the repo (docstrin
55
[OEP-19](https://open-edx-proposals.readthedocs.io/en/latest/oep-0019-bp-developer-documentation.html), and can be linked here.
66

77
Useful information to include:
8+
89
- Which user roles will this change impact? Common user roles are "Learner", "Course Author",
9-
"Developer", and "Operator".
10+
"Developer", and "Operator".
1011
- Include screenshots for changes to the UI (ideally, both "before" and "after" screenshots, if applicable).
1112

1213
## Supporting information
@@ -21,6 +22,7 @@ Please provide detailed step-by-step instructions for manually testing this chan
2122
## Other information
2223

2324
Include anything else that will help reviewers and consumers understand the change.
25+
2426
- Does this change depend on other changes elsewhere?
2527
- Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
2628

.oxlintrc.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"rules": {
88
"eslint/no-unused-vars": ["warn", {
99
// Allow using {ignoredProp, ...keepTheRest} to omit a prop like 'ignoredProp' from an object.
10-
"ignoreRestSiblings": true,
10+
"ignoreRestSiblings": true
1111
}],
1212
// We disable exhaustive-deps because: it's noisy, and we often include extra deps when we want a memoized thing to
1313
// re-calculate after some change, even if we're not using that thing in the calculation.
@@ -21,11 +21,11 @@
2121
// complete, but we rarely if ever want that; we usually want to
2222
// continue invalidating more things immediately. So we don't usually
2323
// want to await this.
24-
"invalidateQueries",
24+
"invalidateQueries"
2525
]
2626
}]
2727
},
2828
"ignorePatterns": [
29-
"webpack.dev-tutor.config.js",
29+
"webpack.dev-tutor.config.js"
3030
]
31-
}
31+
}

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ validate-no-uncommitted-package-lock-changes:
5151
validate:
5252
make validate-no-uncommitted-package-lock-changes
5353
npm run i18n_extract
54-
# We are trying out oxlint. Now that it's been working well for a while with both oxlint and eslint, we have disabled
55-
# eslint, and after a few weeks we'll evaluate whether any problems are slipping through if only oxlint is used.
56-
npm run oxlint
54+
npm run lint
5755
npm run types
5856
npm run test:ci
5957
npm run build

dprint.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"lineWidth": 120,
3+
"indentWidth": 2,
4+
"useTabs": false,
5+
"typescript": {
6+
"quoteStyle": "alwaysSingle",
7+
"jsx.quoteStyle": "preferDouble",
8+
"semiColons": "always",
9+
"trailingCommas": "onlyMultiLine",
10+
"useBraces": "always",
11+
"operatorPosition": "maintain",
12+
"arrowFunction.useParentheses": "maintain",
13+
"module.sortImportDeclarations": "maintain",
14+
"importDeclaration.sortNamedImports": "maintain",
15+
"importDeclaration.preferSingleLine": false,
16+
"exportDeclaration.sortNamedExports": "maintain"
17+
},
18+
"json": {
19+
},
20+
"markdown": {
21+
},
22+
"excludes": [
23+
"**/node_modules",
24+
"**/*-lock.json",
25+
"**/dist",
26+
"**/coverage",
27+
"jest.config.js",
28+
"env.config.*",
29+
"example.env.config.*",
30+
"module.config.js",
31+
"**/messages.{ts,js}"
32+
],
33+
"plugins": [
34+
"https://plugins.dprint.dev/typescript-0.95.15.wasm",
35+
"https://plugins.dprint.dev/json-0.21.3.wasm",
36+
"https://plugins.dprint.dev/markdown-0.21.1.wasm"
37+
]
38+
}

dprint.messages.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
// For messages files, we allow unlimited line length, to keep the file format consistent.
3+
// For now a separate file is required, but this could be simplified when
4+
// https://github.com/dprint/dprint/issues/996 is implemented or if we change to a different formatter.
5+
"extends": "dprint.json",
6+
"lineWidth": 10000,
7+
"includes": ["src/**/messages.{ts,js}"]
8+
// Because this inherits "excludes" from "dprint.json", it's necessary to use "--excludes-override none"
9+
// to run this on the command line.
10+
}

package-lock.json

Lines changed: 200 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
"build": "fedx-scripts webpack",
1414
"i18n_extract": "fedx-scripts formatjs extract --include=plugins",
1515
"stylelint": "stylelint \"plugins/**/*.scss\" \"src/**/*.scss\" \"scss/**/*.scss\" --config .stylelintrc.json",
16-
"lint": "npm run stylelint && fedx-scripts eslint --ext .js --ext .jsx --ext .ts --ext .tsx .",
17-
"oxlint": "oxlint --type-aware --deny-warnings",
18-
"lint:fix": "npm run stylelint -- --fix && fedx-scripts eslint --fix --ext .js --ext .jsx --ext .ts --ext .tsx .",
16+
"lint": "dprint check && dprint --config dprint.messages.json check --excludes-override none && oxlint --type-aware --deny-warnings && npm run stylelint",
17+
"lint:fix": "dprint fmt && dprint --config dprint.messages.json fmt --excludes-override none && oxlint --type-aware --fix",
1918
"start": "fedx-scripts webpack-dev-server --progress",
2019
"start:with-theme": "paragon install-theme && npm start && npm install",
2120
"dev": "PUBLIC_PATH=/authoring/ MFE_CONFIG_API_URL='http://localhost:8000/api/mfe_config/v1' fedx-scripts webpack-dev-server --progress --host apps.local.openedx.io",
@@ -116,7 +115,7 @@
116115
"@types/react": "^18",
117116
"@types/react-dom": "^18",
118117
"axios-mock-adapter": "2.1.0",
119-
"eslint-import-resolver-webpack": "^0.13.8",
118+
"dprint": "^0.54.0",
120119
"fetch-mock-jest": "^1.5.1",
121120
"jest-canvas-mock": "^2.5.2",
122121
"jest-expect-message": "^1.1.3",

0 commit comments

Comments
 (0)