{"id":20093911,"url":"https://github.com/api3dao/eslint-plugin-commons","last_synced_at":"2026-02-27T10:36:34.358Z","repository":{"id":245143381,"uuid":"807612759","full_name":"api3dao/eslint-plugin-commons","owner":"api3dao","description":"The standard ESLint rule set for API3 projects","archived":false,"fork":false,"pushed_at":"2025-03-02T10:27:00.000Z","size":278,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-02T18:11:08.741Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/api3dao.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":"2024-05-29T12:43:05.000Z","updated_at":"2025-03-02T10:26:43.000Z","dependencies_parsed_at":"2024-09-16T14:23:45.166Z","dependency_job_id":"a251ad0a-4a48-45cb-864d-7ebe8b50508a","html_url":"https://github.com/api3dao/eslint-plugin-commons","commit_stats":null,"previous_names":["api3dao/eslint-plugin-commons"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api3dao%2Feslint-plugin-commons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api3dao%2Feslint-plugin-commons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api3dao%2Feslint-plugin-commons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api3dao%2Feslint-plugin-commons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/api3dao","download_url":"https://codeload.github.com/api3dao/eslint-plugin-commons/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252622420,"owners_count":21777987,"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-11-13T16:48:48.249Z","updated_at":"2026-02-27T10:36:34.316Z","avatar_url":"https://github.com/api3dao.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-plugin-commons\n\n\u003e ESLint configurations used across API3 projects.\n\nThe modules consists of multiple ESLint configurations supporting wide variety of targets:\n\n- `universal` - Linting rules for universal (both FE and BE) JS/TS code (with the emphasis on TS).\n- `react` - Linting rules for React code.\n- `next-js` - Linting rules for Next.js code.\n- `jest` - Linting rules for Jest tests. Note, that these rules are only applied for JS/TS files with `*.test.*`\n  extensions.\n\n## Getting started\n\n1. Create an `.eslintrc.js` configuration file in the repo root.\n2. Extend the desired configuration(s).\n3. Specify the `parserOptions.project` option with the path to the `tsconfig.json` file(s).\n4. Install `eslint` (which is a peer dependency of this module) as dev dependencies.\n\nFor example:\n\n```js\nmodule.exports = {\n  extends: ['plugin:@api3/eslint-plugin-commons/universal', 'plugin:@api3/eslint-plugin-commons/jest'],\n  parserOptions: {\n    // We focus primarily on TS and for that we need to specify the TS configs which is project specific. The following\n    // is a common monorepo setup (root config and a config for each package).\n    project: ['./tsconfig.json', './packages/*/tsconfig.json'],\n  },\n};\n```\n\nIf you are using TS, it's possible that ESLint will complain about `.js` files not being present in the project. This\ncan likely be fixed by adding `\"allowJs\": true` to the `tsconfig.json` file.\n\n### Linting commands\n\nWe recommend using the following linting commands inside `package.json` scripts:\n\n```json\n{\n  \"eslint:check\": \"eslint --report-unused-disable-directives --cache --ext js,ts,tsx,jsx . --max-warnings 0\",\n  \"eslint:fix\": \"pnpm run eslint:check --fix\"\n}\n```\n\nThe `--cache` parameter makes ESLint create a `.eslintcache` file in the root of the project. This file should be put to\n`.gitignore`.\n\n## Rules\n\nThe configurations are a collection of various rulesets and the config is quite strict. In general there are rules that:\n\n- Have a fixer (import ordering)\n- Simplify code (combine two nested ifs)\n- Make code more consistent (make `return void` pattern be split on two lines)\n- Fix outdated stuff (avoid `!` ts operator when not necessary)\n- Avoid vulnerabilities and errors (Number.parseInt without radix)\n\nTip: Some rules do have fixer with multiple variants of the fixes. You need to use the IDE to prompt the fixes and\nchoose the one you want.\n\n### Overriding rules\n\nTo override a rule, you can use the `rules` section key in your `.eslintrc.js` file. For example:\n\n```js\n{\n  rules: {\n    'check-file/folder-naming-convention': 'off', // Turns of the kebab-case convention for folder names.\n    'unicorn/filename-case': 'off' // Turns of the kebab-case convention for filenames.\n    'import/no-default-export': 'off', // Turns off the rule that disallows default exports.\n    'import/prefer-default-export': 'error' // Turns on the rule that prefers default exports.\n  }\n}\n```\n\n## For developers\n\nThis sections is intended for developers of this repo.\n\n### Release\n\n1. Run `pnpm version [major|minor|patch]` by choosing the appropriate version bump.\n2. Push the changes to the `main`, either directly or via a pull request.\n3. The CI will register a new version and handle the release process.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapi3dao%2Feslint-plugin-commons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapi3dao%2Feslint-plugin-commons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapi3dao%2Feslint-plugin-commons/lists"}