{"id":13596814,"url":"https://github.com/privatenumber/lintroll","last_synced_at":"2025-03-16T15:31:08.415Z","repository":{"id":41150977,"uuid":"324509332","full_name":"privatenumber/lintroll","owner":"privatenumber","description":"🤖 privatenumber's code linter","archived":false,"fork":false,"pushed_at":"2025-02-08T04:34:34.000Z","size":4196,"stargazers_count":27,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-10T21:39:21.601Z","etag":null,"topics":["config","eslint","flat-config","javascript","minimal","react","typescript","vue"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/privatenumber.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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},"funding":{"github":"privatenumber"}},"created_at":"2020-12-26T08:01:19.000Z","updated_at":"2025-02-08T04:25:22.000Z","dependencies_parsed_at":"2023-11-27T07:26:44.393Z","dependency_job_id":"a3c1ed4f-c5ad-4db2-9fa3-05eab58c9049","html_url":"https://github.com/privatenumber/lintroll","commit_stats":{"total_commits":411,"total_committers":2,"mean_commits":205.5,"dds":0.05596107055961075,"last_synced_commit":"70905b4c8f6994a860fd4a54d4ea1e2b332eaacc"},"previous_names":["privatenumber/lintroll","privatenumber/eslint-config"],"tags_count":127,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Flintroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Flintroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Flintroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Flintroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/privatenumber","download_url":"https://codeload.github.com/privatenumber/lintroll/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822312,"owners_count":20353496,"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":["config","eslint","flat-config","javascript","minimal","react","typescript","vue"],"created_at":"2024-08-01T16:02:49.408Z","updated_at":"2025-03-16T15:31:08.408Z","avatar_url":"https://github.com/privatenumber.png","language":"TypeScript","funding_links":["https://github.com/sponsors/privatenumber"],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"./.github/logo.webp\" width=\"120\"\u003e\n\u003c/p\u003e\n\u003ch2 align=\"center\"\u003e\nlintroll\n\u003cbr\u003e\n\u003ca href=\"https://npm.im/lintroll\"\u003e\u003cimg src=\"https://badgen.net/npm/v/lintroll\"\u003e\u003c/a\u003e\n\u003c/h2\u003e\n\nAn opinionated JavaScript, TypeScript, Vue.js, React, etc. linter.\n\nPowered by ESLint that's enhanced with 12 plugins, covering a wide scope including TypeScript, React, Vue.js, JSON \u0026 YAML, and even Markdown code blocks.\n\n### Features\n\n- **Streamlined syntax**: Single quotes, semicolons, tabs, and [arrow functions](./src/custom-rules/prefer-arrow-functions/) for a clear \u0026 intentional coding style.\n\n- **Versatile language support**: Lints TypeScript, Vue.js, React, JSON \u0026 YAML, and even Markdown code blocks ensuring a wide scope of code.\n\n- **CLI command** Comes with a quick and easy-to-use CLI command, which even supports `eslint.config.ts`.\n\n- **ESLint config**: Also exports an ESLint config so you can itegrate it into your own config!\n\n### What does the linted code look like?\nCheckout the code fixtures from the passing tests [here](https://github.com/search?q=repo%3Aprivatenumber%2Feslint-config+path%3Atests%2F**%2Ffixtures%2Fpass*\u0026type=code).\n\n## Install\n\n```sh\nnpm i -D lintroll\n```\n\n## Using as a CLI command\n\nThe `lintroll` command can be used as drop-in replacement for `eslint`, allowing you to lint your code with this config without any extra configuration.\n\n#### Lint files in the current directory\n\n```sh\nlintroll .\n```\n\n#### Apply auto fix\n\n```sh\nlintroll . --fix\n```\n\n#### Lint with caching enabled\n```sh\nlintroll --cache .\n```\n\n#### Lint only staged files\n```sh\nlintroll --staged .\n```\n\n#### Specify Node.js files\n```sh\nlintroll --node=./build .\n```\n\n### Optional `package.json` script\n\nAdding it to `package.json#scripts` allows you to simply run `npm run lint` (or `pnpm lint`) without needing to pass in the current directory (`.`) every time.\n\nThis also follows the best practice of documenting available commands in a central place.\n\n```diff\n  \"scripts\": {\n+   \"lint\": \"lintroll .\",\n    \"build\": \"...\"\n    \"dev\": \"...\"\n  }\n```\n### Configuration\n\nIf you'd like to customize the linting rules further, you can add one of these ESLint config files to your project root and `lint` will detect them automatically:\n\n- `eslint.config.ts`: The typed version of the configuration file, ideal if you are working with TypeScript.\n\n- `eslint.config.js`: A standard JavaScript file for ESLint configuration, suitable for projects not using TypeScript.\n\n\u003e [!NOTE]\n\u003e When creating your own ESLint config file, you must manually add the `pvtnbr` config. Read the section below to learn how.\n\n### `--help`\n```plaintext\nlintroll\n\nby @privatenumber (Hiroki Osame)\n\nUsage:\n  lintroll [flags...] \u003cfiles...\u003e\n\nFlags:\n      --cache                          Only check changed files\n      --cache-location \u003cstring\u003e        Path to the cache file or directory\n      --fix                            Automatically fix problems\n  -h, --help                           Show help\n      --ignore-pattern \u003cstring\u003e        Pattern of files to ignore\n      --node \u003cstring\u003e                  Enable Node.js rules. Pass in a glob to specify files\n      --quiet                          Report errors only\n      --staged                         Only lint staged files within the files passed in\n```\n\n## Using as an ESLint config\n\nTo use the `eslint` command, create a [flat configuration](https://eslint.org/docs/latest/use/configure/configuration-files-new) file `eslint.config.js` at your project root.\n\n\u003e [!TIP]\n\u003e If you'd like to use TypeScript for your config file (`eslint.config.ts`), use the `lint` command from the previous section. The `eslint` command only supports `eslint.config.js`.\n\n### Simple config\nIf you want a simple setup with no customization, create the following `eslint.config.js`:\n\nModule:\n```js\nexport { default } from 'lintroll'\n```\n\nCommonJS:\n```js\nmodule.exports = require('lintroll')\n```\n\n### Extended config\n\nIn `eslint.config.js`:\n\nModule:\n```js\n// @ts-check\n\nimport { defineConfig, pvtnbr } from 'lintroll'\n\nexport default defineConfig([\n    {\n        // Don't lint these files\n        ignores: [\n            'tests/fixtures/**/*'\n        ]\n    },\n\n    // Configure the pvtnbr config\n    ...pvtnbr({\n\n        // Indicate Node.js project\n        node: true,\n\n        // Indicate Vue.js project (auto-detected by default)\n        vue: true\n    })\n\n    // Other configs...\n])\n```\n\nCommonJS:\n```js\n// @ts-check\n\nconst { defineConfig, pvtnbr } = require('lintroll')\n\nmodule.exports = defineConfig([\n    {\n        // Don't lint these files\n        ignores: [\n            'tests/fixtures/**/*'\n        ]\n    },\n\n    // Configure the pvtnbr config\n    ...pvtnbr({\n\n        // Indicate Node.js project or pass in file paths\n        node: true\n    })\n\n    // Other configs...\n])\n```\n\n\u003e [!TIP]\n\u003e If you'd like to type check your `eslint.config.js` file, you can add [`// @ts-check`](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check) to the top.\n\n\n## Linting coverage\n\nThis ESLint config comprehensively supports a variety of languages and file types, ensuring coding standards and best practices across your project.\n\n| Language/File Type | Extensions |\n| ------------------ | -------------------- |\n| JavaScript | `.js`, `.cjs`, `.mjs` |\n| Node.js | `.cjs`, `.mjs` |\n| Service Workers | `.sw.js`, `.sw.ts` |\n| TypeScript | `.ts`, `.cts`, `.mts`, `.d.ts` |\n| Vue.js | `.vue` |\n| React | `.jsx`, `.tsx` |\n| JSON | `.json`, `.json5`, `.jsonc` |\n| YML | `.yml`, `.yaml` |\n| Markdown | `.md` |\n\n\n### Integrated plugins\n\nEach plugin in this ESLint configuration targets specific aspects of your code, ensuring quality and consistency.\n\n| Plugin | Focus area |\n| ------ | ---------- |\n| [eslint-comments](https://www.npmjs.com/package/@eslint-community/eslint-plugin-eslint-comments) | ESLint directive comments |\n| [node](https://www.npmjs.com/package/eslint-plugin-node) | Node.js coding practices |\n| [@typescript-eslint](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) | TypeScript coding Practices |\n| [@stylistic](https://www.npmjs.com/package/@stylistic/eslint-plugin) | JavaScript \u0026 TypeScript code style |\n| [promise](https://www.npmjs.com/package/eslint-plugin-promise) | Promises best practices |\n| [regexp](https://www.npmjs.com/package/eslint-plugin-regexp) | Regular Expressions best practices |\n| [import](https://www.npmjs.com/package/eslint-plugin-import) | ES6+ Import/Export |\n| [jsonc](https://www.npmjs.com/package/eslint-plugin-jsonc) | JSON, JSON5, and JSONC style |\n| [yml](https://www.npmjs.com/package/eslint-plugin-yml) | YAML style |\n| [vue](https://www.npmjs.com/package/eslint-plugin-vue) | Vue.js Templates \u0026 Scripts |\n| [react](https://www.npmjs.com/package/eslint-plugin-react) \u003c!--\u0026 [react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)--\u003e | React best practices\u003c!--\u0026 React Hooks--\u003e |\n| [markdown](https://www.npmjs.com/package/eslint-plugin-markdown) | Markdown embedded code blocks |\n| [no-use-extend-native](https://www.npmjs.com/package/eslint-plugin-no-use-extend-native) | Native prototype extensions |\n| [unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn) | Miscellaneous code quality rules |\n| [Custom](https://github.com/privatenumber/eslint-config/tree/develop/src/custom-rules) | Custom rules made for this config |\n\n## API\n\n### pvtbr(options)\n\nThe main config factory. It takes an object of options and returns a config object.\n\n#### options.node\n\nType: `boolean | string[]`\n\nDefault: `false`\n\nWhether to lint Node.js code. When `true`, it will treat all files as Node.js files. You can also pass in an array of glob patterns to specify which files are Node.js files.\n\n### defineConfig(configs)\n\nAn identity function to enforce type checking on the config.\n\n#### configs\n\nType: `FlatConfig | FlatConfig[]`\n\n## Awesome ESLint configs\n\nMake sure you also check out these awesome ESLint configs. They are a constant source of inspiration for me, and are great alternatives to consider.\n\n- [antfu/eslint-config](https://github.com/antfu/eslint-config) by [@antfu](https://github.com/antfu)\n- [sxzz/eslint-config](https://github.com/sxzz/eslint-config) by [@sxzz](https://github.com/sxzz)\n- [@ota-meshi/eslint-plugin](https://github.com/ota-meshi/eslint-plugin) by [@ota-meshi](https://github.com/ota-meshi)\n- [standard config](https://github.com/standard/eslint-config-standard) by [@feross](https://github.com/feross)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Flintroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprivatenumber%2Flintroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Flintroll/lists"}