-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: format all files #22
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
dist | ||
CHANGELOG.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ export default [ | |
afterEach: "readonly", | ||
before: "readonly", | ||
after: "readonly", | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
}, | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
"build": "node scripts/build.js", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"fmt": "prettier --write ." | ||
"fmt": "prettier --write .", | ||
"fmt:check": "prettier --check ." | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
|
@@ -20,7 +21,8 @@ | |
"*.js": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
] | ||
], | ||
"!(*.js)": "prettier --write --ignore-unknown" | ||
Comment on lines
21
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prettier runs on all files, but separate https://github.com/lint-staged/lint-staged?tab=readme-ov-file#task-concurrency |
||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.0.0", | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,6 +1,5 @@ | ||||
# ESLint Compatibility Utilities | ||||
|
||||
|
||||
## Overview | ||||
|
||||
This packages contains functions that allow you to wrap existing ESLint rules, plugins, and configurations that were intended for use with ESLint v8.x to allow them to work as-is in ESLint v9.x. | ||||
|
@@ -29,9 +28,9 @@ deno add @eslint/compat | |||
|
||||
This package exports the following functions in both ESM and CommonJS format: | ||||
|
||||
* `fixupRule(rule)` - wraps the given rule in a compatibility layer and returns the result | ||||
* `fixupPluginRules(plugin)` - wraps each rule in the given plugin using `fixupRule()` and returns a new object that represents the plugin with the fixed-up rules | ||||
* `fixupConfigRules(configs)` - wraps all plugins found in an array of config objects using `fixupPluginRules()` | ||||
- `fixupRule(rule)` - wraps the given rule in a compatibility layer and returns the result | ||||
- `fixupPluginRules(plugin)` - wraps each rule in the given plugin using `fixupRule()` and returns a new object that represents the plugin with the fixed-up rules | ||||
- `fixupConfigRules(configs)` - wraps all plugins found in an array of config objects using `fixupPluginRules()` | ||||
|
||||
### Fixing Rules | ||||
|
||||
|
@@ -77,15 +76,15 @@ import { fixupPluginRules } from "@eslint/compat"; | |||
import somePlugin from "eslint-plugin-some-plugin"; | ||||
|
||||
export default [ | ||||
{ | ||||
plugins: { | ||||
// insert the fixed plugin instead of the original | ||||
somePlugin: fixupPluginRules(somePlugin) | ||||
}, | ||||
rules: { | ||||
"somePlugin/rule-name": "error" | ||||
} | ||||
} | ||||
{ | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prettier uses tabs by default? Seems like too much space from the existing one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is only 1 tab, but GitHub by default renders tabs as 8 spaces so it looks huge. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's configurable: I've just changed my Tab size preference to 4 and this looks the same as before on my screen: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, prettier's default indentation is 2 spaces. But we configured it in this project to use tabs: Line 2 in 3e9eb67
|
||||
plugins: { | ||||
// insert the fixed plugin instead of the original | ||||
somePlugin: fixupPluginRules(somePlugin), | ||||
}, | ||||
rules: { | ||||
"somePlugin/rule-name": "error", | ||||
}, | ||||
}, | ||||
]; | ||||
``` | ||||
|
||||
|
@@ -97,15 +96,15 @@ const { fixupPluginRules } = require("@eslint/compat"); | |||
const somePlugin = require("eslint-plugin-some-plugin"); | ||||
|
||||
module.exports = [ | ||||
{ | ||||
plugins: { | ||||
// insert the fixed plugin instead of the original | ||||
somePlugin: fixupPluginRules(somePlugin) | ||||
}, | ||||
rules: { | ||||
"somePlugin/rule-name": "error" | ||||
} | ||||
} | ||||
{ | ||||
plugins: { | ||||
// insert the fixed plugin instead of the original | ||||
somePlugin: fixupPluginRules(somePlugin), | ||||
}, | ||||
rules: { | ||||
"somePlugin/rule-name": "error", | ||||
}, | ||||
}, | ||||
]; | ||||
``` | ||||
|
||||
|
@@ -119,10 +118,10 @@ import { fixupConfigRules } from "@eslint/compat"; | |||
import someConfig from "eslint-config-some-config"; | ||||
|
||||
export default [ | ||||
...fixupConfigRules(someConfig), | ||||
{ | ||||
// your overrides | ||||
} | ||||
...fixupConfigRules(someConfig), | ||||
{ | ||||
// your overrides | ||||
}, | ||||
]; | ||||
``` | ||||
|
||||
|
@@ -134,10 +133,10 @@ const { fixupConfigRules } = require("@eslint/compat"); | |||
const someConfig = require("eslint-config-some-config"); | ||||
|
||||
module.exports = [ | ||||
...fixupConfigRules(someConfig), | ||||
{ | ||||
// your overrides | ||||
} | ||||
...fixupConfigRules(someConfig), | ||||
{ | ||||
// your overrides | ||||
}, | ||||
]; | ||||
``` | ||||
|
||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{ | ||
"name": "@eslint/compat", | ||
"version": "1.0.1", | ||
"exports": "./dist/esm/index.js", | ||
"publish": { | ||
"include": [ | ||
"dist/esm/index.js", | ||
"dist/esm/index.d.ts", | ||
"dist/esm/types.d.ts", | ||
"dist/esm/types.ts", | ||
"README.md", | ||
"jsr.json", | ||
"LICENSE" | ||
] | ||
} | ||
"name": "@eslint/compat", | ||
"version": "1.0.1", | ||
"exports": "./dist/esm/index.js", | ||
"publish": { | ||
"include": [ | ||
"dist/esm/index.js", | ||
"dist/esm/index.d.ts", | ||
"dist/esm/types.d.ts", | ||
"dist/esm/types.ts", | ||
"README.md", | ||
"jsr.json", | ||
"LICENSE" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
"outDir": "dist/cjs", | ||
"moduleResolution": "Bundler", | ||
"module": "Preserve" | ||
}, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"files": ["dist/esm/index.js"], | ||
"files": ["dist/esm/index.js"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should rather be
fmt:fix
and the check should befmt
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting is currently not covered by our package-json-conventions.
@nzakas what do you think about script names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest lets keep the script name to be
format
for analysing formatting problems. andformat:fix
for the write formatted changes. I can send a PR to add it to package conventions as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
&format:fix
would be aligned withlint
&lint:fix
, which looks good for consistency, but in the context of the word "format" it might be surprising thatformat
only checks the format, so maybeformat:check
&format:fix
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this PR has a high potential of running into merge conflicts with any future PRs, what do you think about merging this now as-is, and continuing this discussion on a PR that updates package conventions? Then, we could get back to this repo and update the script names if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea lets merge this PR and then pick this as a separate issue.