-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Blog post: 'If I wrote a linter' #284
Draft
JoshuaKGoldberg
wants to merge
23
commits into
main
Choose a base branch
from
if-i-wrote-a-linter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
35b5c1d
blog post: 'If I wrote a linter'
JoshuaKGoldberg 9ed2d19
Progress: thoughts on TypeScript integrations
JoshuaKGoldberg 1fd67fe
touchups on type info
JoshuaKGoldberg 6de9f68
tweak the bold text
JoshuaKGoldberg f688733
embeddable by design
JoshuaKGoldberg 8916308
Type-safe plugins, rules, and settings
JoshuaKGoldberg f0f56da
two lil tweaks
JoshuaKGoldberg eb53ff8
'common' use
JoshuaKGoldberg f63d8d4
lil type shortcuts note
JoshuaKGoldberg e3ad6e5
rfc 120 link
JoshuaKGoldberg 06eb1f9
heading: no js/ts
JoshuaKGoldberg 2125f56
fix a ts block
JoshuaKGoldberg dba1be8
more on plugins
JoshuaKGoldberg b5444ff
typo in session-objects footnote ref
JoshuaKGoldberg 932ba3a
strongly typed rules, not just rule options
JoshuaKGoldberg d115d26
Start on consistency
JoshuaKGoldberg e0be4d5
WIP start on developer features
JoshuaKGoldberg 072fac3
export default syntax fix
JoshuaKGoldberg 475e3c4
export default syntax fix, again
JoshuaKGoldberg 74044b3
nit: i work on linters
JoshuaKGoldberg 71acb82
Formatting after linting
JoshuaKGoldberg 3e37a78
Merge branch 'main' into if-i-wrote-a-linter
JoshuaKGoldberg be8b628
Some spelling fixes
JoshuaKGoldberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
pubDate: 2024-08-23 | ||
description: "Not that I would, but if I did, here's what I'd want it to be like." | ||
image: | ||
alt: "TODO_NAME from Fiddler on the Roof TODO_ACTIVITY" | ||
src: "~/assets/blog/fiddler-on-the-roof-TODO_NAME-TODO_ACTIVITY.jpg" | ||
title: "If I Wrote a Linter" | ||
--- | ||
|
||
import todo from "~/assets/blog/fiddler-on-the-roof-TODO_NAME-TODO_ACTIVITY.jpg"; | ||
import LabeledImage from "~/components/blog/mdx/LabeledImage.astro"; | ||
import LabeledVideo from "~/components/blog/mdx/LabeledVideo.astro"; | ||
|
||
<LabeledImage | ||
alt="TODO_NAME from Fiddler on the Roof TODO_ACTIVITY" | ||
description="TODO_NAME from Fiddler on the Roof enjoying linting his code with a very strict configuration." | ||
original="https://gunshowcomic.com/648" | ||
src={todo} | ||
/> | ||
|
||
## Ideology | ||
|
||
### Consistent Glossary | ||
|
||
### Granular Rule Categories | ||
|
||
Logical and stylistic rules with recommended and strict | ||
|
||
### Thorough FAQs | ||
|
||
Full explanation docs for all decisions | ||
|
||
### First Party Community Repositories | ||
|
||
First party built in for what is the current slate of popular plugins | ||
|
||
## Features for Users | ||
|
||
### Type Aware By Default | ||
|
||
### Strongly Typed Rule Options | ||
|
||
...export functions? | ||
|
||
### First Party Templates | ||
|
||
## Features for Developers | ||
|
||
### Virtual File System | ||
|
||
### Cross File Fixes | ||
|
||
## Implementation | ||
|
||
### TypeScript Source Code | ||
|
||
It is my sincere belief that **a linter for an ecosystem must be written in a standard flavor of that ecosystem's primary language**. | ||
For the web ecosystem, that means TypeScript. | ||
|
||
I love the speed gains of native-speed tooling such as Biome and Oxc. | ||
Rust is a lovely language. | ||
But there are two issues with using an "alternative" language such as Rust: | ||
|
||
- | ||
|
||
ESLint is written in vanilla JavaScript with JSDoc types to inform type checking. | ||
|
||
### Session Objects | ||
|
||
Full project context available up front including preprocessors and session object | ||
|
||
### Pluggable Architecture and APIs | ||
|
||
Pluggable api for embedding in places like typescript, TS, config and biome project |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Super raw notes...
Downgrade visual severity to warning by default in the editor extension
Pluggable type system API alongside parser
Background daemon for project type information
Lintbase equivalent
Community outreach for major breakages and new versions - sourced by lintbase
Current version of ajv schema or a maintained equivalent, maybe ... zod?
AST selectors can only be the nodes. Easier the system and internal complexity
Proactive wotk with community linters
Proactive perception and PR work
Community discord and office hours
no stalebots
Allowlist of folder overrides in the root-level config
zod schema for rule options
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.
define config has dedicated property for ignores
granular report configuration: switch suggestion(s) to fix
standardized options: always falsy default if possible
always TypeOrValueSpecifier, never string names
standardized names: not just no
no-
, but allow/check*rule messages: be explicit about intent. E.g. rather than just "A record is preferred over an index signature", also mention it's for stylistic consistency.
No subjective, prescriptive, blurry-line rules. e.g. cyclomatic complexity, max-file-size/lines, etc.
automatic config migrations for deprecations and major versions if possible. see tslint-to-eslint-config
-> if possible means your config must be in a nice statically analyzable format.
maybe implement alongside eslint-nibble
maintain non-zero and positive relationships with both the community with neighbors. "coopertition"
rule options always include: description, why, why not, incorrect+correct examples tabs
thorough faqs, alongside glossary and troubleshooting
clearly delineated areas of plugins for useful things not core to most projects. e.g. lint rules that replace typescript functionality
Nested key in config for monorepo support
Only allow object schema types, and use Zod
Use TypeOrValueSpecifier, never general strings
Require rationale and invalid/valid table for all rules + options
Require 'when not to use it' for all rules
Aggressively prune legacy behaviors with deprecation in one major, removal in next - providing migrations if possible. Net positive for maintenance.
Built-in capturing all uses in supermajority of GitHub projects: md, yml, json (+1 eslint itself), also regex, sorting...
Community org capturing all common uses.
have them out of the box be a dpeendnecy of the linter? maybe not doable, but at least provided in config-initializer?
clearly delineate matrix of:
• logic vs. style
• common vs. strict
Rule message guidelines.
• Always be explicit on whether it's a stylistic, best practice, likely bug, etc.
No 'prefer-', 'no-', etc. in rule names. Pithier, less churn.
--interactive mode. for each issue:
• opens in your editor
• surfaces rich docs in the terminal
• have common resolutions & such shown
see elm and rust super nice compiler errors
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.
http://localhost:3000/rules/prefer-optional-chain#allowpotentiallyunsafefixesthatmodifythereturntypeiknowwhatimdoing - belies a need to be able to switch messageId fixers from suggestion to fix or vice versa. would be nice for codemods. requirement: all rules use messageIds, not raw message text.