{"id":17657995,"url":"https://github.com/3rd/linter","last_synced_at":"2025-04-28T14:05:05.102Z","repository":{"id":180901184,"uuid":"658697114","full_name":"3rd/linter","owner":"3rd","description":"Notes and configurations for my linting setup.","archived":false,"fork":false,"pushed_at":"2025-02-18T20:19:59.000Z","size":647,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T14:04:20.503Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3rd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-26T10:03:48.000Z","updated_at":"2025-02-18T20:20:03.000Z","dependencies_parsed_at":"2023-11-11T12:25:37.436Z","dependency_job_id":"54fee90c-167d-4899-8337-81d39ec975e8","html_url":"https://github.com/3rd/linter","commit_stats":null,"previous_names":["3rd/linter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd%2Flinter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd%2Flinter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd%2Flinter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3rd%2Flinter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3rd","download_url":"https://codeload.github.com/3rd/linter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251326836,"owners_count":21571634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T14:43:52.064Z","updated_at":"2025-04-28T14:05:05.078Z","avatar_url":"https://github.com/3rd.png","language":"TypeScript","readme":"# Linting setup\n\nThis repo holds some of my linting setup.\n\n## My ESLint Config\n\nI've been using a **global** \u0026 **dynamic** ESLint config for a long time.\n\nIt's very special, it's taken me many iterations to get it to work, and it has served me well.\nThe current version has been stable for a while and works great in my Neovim setup.\n\n👉 [**The Config™**](./eslint)\n\\\n👉 [How I'm using it with Neovim](https://github.com/3rd/config/blob/master/home/dotfiles/nvim/lua/modules/language-support/lsp.lua#L216)\n\n\u003e **Warning** \u003e \\\n\u003e This is my personal setup; it's not a packaged, ready-to-eat solution for others to just plug and have it working.\n\u003e Don't throw tomatoes at me.\n\n### A global ESLint config? What?\n\nHaving a **global config** might sound like a silly and impractical idea, but hear me out.\n\nBy global config _I don't mean a config that applies when you're in a project that doesn't have ESLint configured_.\n\nI mean **a config that always applies to all the projects**, whether you're in a project without an ESLint configuration,\nor in a project that has it's own configuration, it doesn't matter, you always get the global config.\n\nThe idea has been generally frowned upon, the main arguments/issues being that.\n\n1. Everyone in the team should use the same linting configuration.\n2. Different projects use different rules, plugins, and parsers.\n\n#### 1. **Everyone in the team should use the same linting configuration**\n\nObviously, I disagree with this, and I don't consider it an argument.\n\\\nWhen I think about linting as a component of my workflow, my mind splits the concept into two characters:\n\n- **The Project Linter**\n  - guards our project's code quality and consistency\n  - has a collectively agreed-upon set of rules and plugins\n- **My Linter**\n  - guards my quality and consistency\n  - has a custom set of rules and plugins that I value for myself\n\nIn a correctly configured setup, linting should be enforced on pre-commit, and there should be no harm in a developer using their own custom configuration.\n\n#### 2. Different projects use different rules, plugins, and parsers\n\nOf course, using a global linting configuration doesn't make sense with a static config.\n\nThe only way this can work is if the configuration is **dynamic** and **automatically generated** when required by ESLint, by inspecting the context the user is in,\nanalyzing the project, its dependencies, deciding what parser/plugins/rules/settings should be used, etc.\n\nIt used to be harder to get this to work in the past; it required lots of hacks and monkey patching to make ESLint ignore everything in the cwd and load the plugins from a different place, but now it's super easy.\n\n### Advantages of using a global config\n\n1. I sit down and truly **design the way I write code** in general.\n2. I have a **consistent setup across all the projects** I'm working on.\n3. I configure all my linting rules and settings in a **single place**.\n4. I **never have to setup ESLint** for my private, one-man projects, again.\n5. I have a **much stricter setup** than my team that we'd never agree on, but which makes my work better.\n6. I can **use any plugin and any rule** I want, including my own plugins and rules.\n7. I can **use things that can't be set up for the whole project** because:\n   - Jimmy works on a PotatoPi, and his computer smells like burnt plastic if any resource-intensive rules are used.\n   - Jane and Mark insist that they really like `!!` more than `Boolean()` and that it would be a dread for them to get better.\n   - I don't want to add my experimental plugins to the project and potentially kill the DX for everyone.\n\n### Conclusion\n\nThis setup may be a weird way to do things, but it has worked super well for me.\n\\\nI think thinking about how we work and creating processes and tools to help us be better is something super valuable\nthat we should invest time in and iterate on.\n\n## AST-GREP\n\n[next-up]\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3rd%2Flinter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3rd%2Flinter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3rd%2Flinter/lists"}