{"id":14978320,"url":"https://github.com/algolia/eslint-config-algolia","last_synced_at":"2025-04-06T16:12:33.298Z","repository":{"id":34588958,"uuid":"38536091","full_name":"algolia/eslint-config-algolia","owner":"algolia","description":"Algolia's ESLint config and prettier instructions for JavaScript projects","archived":false,"fork":false,"pushed_at":"2025-03-30T12:39:32.000Z","size":6961,"stargazers_count":27,"open_issues_count":21,"forks_count":7,"subscribers_count":67,"default_branch":"master","last_synced_at":"2025-03-30T13:32:23.590Z","etag":null,"topics":["algolia","eslint","eslint-config","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/algolia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2015-07-04T14:15:42.000Z","updated_at":"2024-10-15T15:59:41.000Z","dependencies_parsed_at":"2023-02-15T10:46:31.897Z","dependency_job_id":"43427f66-92e2-4ea0-ad79-8da7afe651cc","html_url":"https://github.com/algolia/eslint-config-algolia","commit_stats":{"total_commits":740,"total_committers":26,"mean_commits":28.46153846153846,"dds":0.4337837837837838,"last_synced_commit":"fc2a521e9ae17d91141c9a3e8cbd0f67a034f311"},"previous_names":[],"tags_count":77,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Feslint-config-algolia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Feslint-config-algolia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Feslint-config-algolia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algolia%2Feslint-config-algolia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/algolia","download_url":"https://codeload.github.com/algolia/eslint-config-algolia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509235,"owners_count":20950232,"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":["algolia","eslint","eslint-config","javascript"],"created_at":"2024-09-24T13:57:22.655Z","updated_at":"2025-04-06T16:12:33.280Z","avatar_url":"https://github.com/algolia.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# eslint-config-algolia\n\n[![Version][version-svg]][package-url] [![Build Status][travis-svg]][travis-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url]\n\nThis is [Algolia](https://www.algolia.com/)'s linting and formatting of\nJavaScript projects (Vanilla, React, Vue) repository.\n\nIt explains to you how to setup your project to use it and never\nworry again about indentation, curly spaces, let vs const etc...\n\nThis code style is only as useful as you activate travis for your project\nso that it runs linting in your test phase and warns you.\n\nJust **focus** on coding.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [Setup your project](#setup-your-project)\n  - [Base requirements](#base-requirements)\n  - [Vanilla](#vanilla)\n  - [Jest](#jest)\n  - [React](#react)\n  - [Flow (deprecated)](#flow-deprecated)\n  - [Flow with React (deprecated)](#flow-with-react-deprecated)\n  - [TypeScript](#typescript)\n  - [TypeScript with React](#typescript-with-react)\n  - [Vue](#vue)\n  - [Node.js](#nodejs)\n- [Existing codebase setup](#existing-codebase-setup)\n- [Setup autofix in IDE](#setup-autofix-in-ide)\n- [Ignoring files](#ignoring-files)\n- [Contributing](#contributing)\n  - [Test](#test)\n  - [Release](#release)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Setup your project\n\n### Base requirements\n\n```sh\nyarn add \\\neslint @babel/eslint-parser prettier \\\neslint-config-algolia eslint-config-prettier \\\neslint-plugin-import eslint-plugin-prettier \\\n@eslint-community/eslint-plugin-eslint-comments eslint-plugin-jsdoc \\\n--dev\n```\n\n### Vanilla\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: 'algolia'\n};\n```\n\n**eslint.config.js**\n```js\nconst algolia = require('eslint-config-algolia/flat/base');\nmodule.exports = [\n  ...algolia,\n];\n```\n\n**package.json**\n```json\n{\n  \"scripts\": {\n    \"test\": \"npm run lint\",\n    \"lint\": \"eslint .\",\n    \"lint:fix\": \"npm run lint -- --fix\"\n  }\n}\n```\n\n### Jest\n\nWe recommend using Jest as a test runner.\n\n**terminal**\n```sh\nyarn add eslint-plugin-jest --dev\n```\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: ['algolia', 'algolia/jest']\n};\n```\n\n**eslint.config.js**\n```js\nconst algolia = require('eslint-config-algolia/flat/base');\nconst algoliaJest = require('eslint-config-algolia/flat/jest');\nmodule.exports = [\n  ...algolia,\n  ...algoliaJest,\n];\n```\n\n**package.json**\n```json\n{\n  \"scripts\": {\n    \"test\": \"npm run lint\",\n    \"lint\": \"eslint .\",\n    \"lint:fix\": \"npm run lint -- --fix\"\n  }\n}\n```\n\n### React\n\n**terminal**\n```sh\nyarn add eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y --dev\n```\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: ['algolia', 'algolia/react']\n};\n```\n\n**eslint.config.js**\n```js\nconst algolia = require('eslint-config-algolia/flat/base');\nconst algoliaReact = require('eslint-config-algolia/flat/react');\nmodule.exports = [\n  ...algolia,\n  ...algoliaReact,\n];\n```\n\n**package.json**\n```json\n{\n  \"scripts\": {\n    \"test\": \"npm run lint\",\n    \"lint\": \"eslint .\",\n    \"lint:fix\": \"npm run lint -- --fix\"\n  }\n}\n```\n\n### Flow (deprecated)\n\n**terminal**\n```sh\nyarn add eslint-plugin-flowtype --dev\n```\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: ['algolia', 'algolia/flowtype']\n};\n```\n\n### Flow with React (deprecated)\n\n**terminal**\n```sh\nyarn add eslint-plugin-flowtype eslint-plugin-react eslint-plugin-react-hooks --dev\n```\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: ['algolia', 'algolia/flowtype', 'algolia/react']\n};\n```\n\n**package.json**\n```json\n{\n  \"scripts\": {\n    \"test\": \"npm run lint\",\n    \"lint\": \"eslint .\",\n    \"lint:fix\": \"npm run lint -- --fix\"\n  }\n}\n```\n\n### TypeScript\n\n**terminal**\n```sh\nyarn add @typescript-eslint/parser @typescript-eslint/eslint-plugin typescript --dev\n```\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: ['algolia', 'algolia/typescript'],\n\n  parserOptions: {\n    project: '\u003cpath-to-tsconfig.json\u003e',\n  },\n};\n```\n\n**eslint.config.js**\n```js\nconst algolia = require('eslint-config-algolia/flat/base');\nconst algoliaTypescript = require('eslint-config-algolia/flat/typescript');\nmodule.exports = [\n  ...algolia,\n  ...algoliaTypescript,\n  {\n    languageOptions: {\n      parserOptions: {\n        project: '\u003cpath-to-tsconfig.json\u003e',\n      },\n    },\n  },\n];\n```\n\n**package.json**\n```json\n{\n  \"scripts\": {\n    \"test\": \"npm run lint\",\n    \"lint\": \"eslint --ext .js,.ts,.tsx .\",\n    \"lint:fix\": \"npm run lint -- --fix\"\n  }\n}\n```\n\nYou also need to make sure that all the files you want to lint are also included in `tsconfig.json` with the `include` property.\n\n### TypeScript with React\n\n**terminal**\n```sh\nyarn add @typescript-eslint/parser @typescript-eslint/eslint-plugin typescript eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y --dev\n```\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: ['algolia', 'algolia/react', 'algolia/typescript']\n};\n```\n**Note**: Be sure to put the `algolia/typescript` configuration last so the parser is properly set for TypeScript files.\n\n**eslint.config.js**\n```js\nconst algolia = require('eslint-config-algolia/flat/base');\nconst algoliaReact = require('eslint-config-algolia/flat/react');\nconst algoliaTypescript = require('eslint-config-algolia/flat/typescript');\nmodule.exports = [\n  ...algolia,\n  ...algoliaReact,\n  ...algoliaTypescript,\n];\n```\n\n**package.json**\n```json\n{\n  \"scripts\": {\n    \"test\": \"npm run lint\",\n    \"lint\": \"eslint --ext .js,.ts,.tsx .\",\n    \"lint:fix\": \"npm run lint -- --fix\"\n  }\n}\n```\n\n\n### Vue\n\n**terminal**\n```sh\nyarn add eslint-plugin-vue --dev\n```\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: ['algolia', 'algolia/vue']\n};\n```\n\n**eslint.config.js**\n```js\nconst algolia = require('eslint-config-algolia/flat/base');\nconst algoliaVue = require('eslint-config-algolia/flat/vue');\nmodule.exports = [\n  ...algolia,\n  ...algoliaVue,\n];\n```\n\n**package.json**\n```json\n{\n  \"scripts\": {\n    \"test\": \"npm run lint\",\n    \"lint\": \"eslint --ext .js,.vue .\",\n    \"lint:fix\": \"npm run lint -- --fix\"\n  }\n}\n```\n\n**VSCode**\n```json\n{\n  \"eslint.validate\": [\n    {\n      \"language\": \"vue\",\n      \"autoFix\": true\n    }\n  ]\n}\n```\n\n### Node.js\n\n**package.json**\n```json\n{\n  \"scripts\": {\n    \"test\": \"npm run lint\",\n    \"lint\": \"eslint .\",\n    \"lint:fix\": \"npm run lint -- --fix\"\n  }\n}\n```\n\n**.eslintrc.js**\n```js\nmodule.exports = {\n  extends: 'algolia',\n  rules: {\n    'import/no-commonjs': 'off'\n  },\n};\n```\n\n**eslint.config.js**\n```js\nconst algolia = require('eslint-config-algolia/flat/base');\nmodule.exports = [\n  ...algolia,\n  {\n    rules: {\n      'import/no-commonjs': 'off'\n    }\n  },\n];\n```\n\n## Existing codebase setup\n\nIf you have a lot of files already written and wants to now use\nour linting tools, you might have a lot of errors. There's hope!\n\nJust reformat all the files automatically and then manually fix remaining\nerrors.\n\n**terminal**\n```sh\nnpm run lint:fix\n```\n\n## Setup autofix in IDE\n\nDon't overlook this part, autofixing on save is a huge productivity boost.\n\nUse any [ESLint integration](http://eslint.org/docs/user-guide/integrations)\nand activate \"Fix on save\" option.\n\nAlso activate \"Lint HTML files\" when dealing with `.vue` components.\n\n## Ignoring files\n\nSee \"Ignoring Files and Directories\" on [ESLint website](http://eslint.org/docs/user-guide/configuring.html#ignoring-files-and-directories).\n\n## Contributing\n\n### Test\n\nWe have a [sample-project](packages/test).\n\n```sh\nyarn test\n```\n\n### Release\n\n```sh\nnpm run release\n```\n\n[version-svg]: https://img.shields.io/npm/v/eslint-config-algolia.svg?style=flat-square\n[package-url]: https://npmjs.org/package/eslint-config-algolia\n[travis-svg]: https://img.shields.io/travis/algolia/eslint-config-algolia/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/algolia/eslint-config-algolia\n[license-image]: http://img.shields.io/badge/license-MIT-green.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/eslint-config-algolia.svg?style=flat-square\n[downloads-url]: http://npm-stat.com/charts.html?package=eslint-config-algolia\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgolia%2Feslint-config-algolia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falgolia%2Feslint-config-algolia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgolia%2Feslint-config-algolia/lists"}