All Projects → algolia → eslint-config-algolia

algolia / eslint-config-algolia

Licence: MIT license
Algolia's ESLint config and prettier instructions for JavaScript projects

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects
typescript
32286 projects

Projects that are alternatives of or similar to eslint-config-algolia

Algoliasearch Netlify
Official Algolia Plugin for Netlify. Index your website to Algolia when deploying your project to Netlify with the Algolia Crawler
Stars: ✭ 208 (+670.37%)
Mutual labels:  algolia
atomic-algolia
An NPM package for running atomic updates to an Algolia indices
Stars: ✭ 65 (+140.74%)
Mutual labels:  algolia
laravel-scout-settings
DEPRECATED: Use of this repository is deprecated. Please use Scout Extended - https://github.com/algolia/scout-extended instead.
Stars: ✭ 23 (-14.81%)
Mutual labels:  algolia
Angular Instantsearch
⚡️Lightning-fast search for Angular apps, by Algolia
Stars: ✭ 219 (+711.11%)
Mutual labels:  algolia
eslint-config-fullstack
A complete ESLint config file to help students avoid errors and learn best practices
Stars: ✭ 16 (-40.74%)
Mutual labels:  eslint-config
eslint-config-leapfrog
Set of ESLint rules for JavaScript projects at Leapfrog.
Stars: ✭ 15 (-44.44%)
Mutual labels:  eslint-config
Atom Autocomplete Module Import
⚛️ Search & install npm packages from import/require statements.
Stars: ✭ 182 (+574.07%)
Mutual labels:  algolia
eslint-config
MOXY eslint configuration to be used across several JavaScript projects
Stars: ✭ 14 (-48.15%)
Mutual labels:  eslint-config
eslint-config-ns
ESLint config ready to be used in multiple projects. Based on Airbnb's code style with prettier, jest and react support.
Stars: ✭ 27 (+0%)
Mutual labels:  eslint-config
eslintconfig.dev
Collection of curated ESLint configurations
Stars: ✭ 36 (+33.33%)
Mutual labels:  eslint-config
Docs
Repository of Twilio SendGrid's product documentation.
Stars: ✭ 221 (+718.52%)
Mutual labels:  algolia
Learn X By Doing Y
🛠️ Learn a technology X by doing a project - Search engine of project-based learning
Stars: ✭ 242 (+796.3%)
Mutual labels:  algolia
eslint-config-galex
hopefully the last eslint config you'll ever need - customizable & modern best practices for JS, TS, Node, React, Remix, Next, Jest, testing-library & storybook
Stars: ✭ 166 (+514.81%)
Mutual labels:  eslint-config
What Hn Says Webext
Web Extension: Easily find Hacker News discussions about the page you're currently browsing.
Stars: ✭ 214 (+692.59%)
Mutual labels:  algolia
search-insights.js
Library for reporting click, conversion and view metrics using the Algolia Insights API
Stars: ✭ 39 (+44.44%)
Mutual labels:  algolia
Docsearch Scraper
DocSearch - Scraper
Stars: ✭ 188 (+596.3%)
Mutual labels:  algolia
eslint-plugin-stedi-aws-rules
Best practices around using AWS SDK & Lambda runtime in JavaScript / TypeScript projects by Stedi.
Stars: ✭ 30 (+11.11%)
Mutual labels:  eslint-config
mybgg
A template that lets you quickly set up a site for searching and filtering your boardgames.
Stars: ✭ 54 (+100%)
Mutual labels:  algolia
nuxtjs-woocommerce
NuxtJS (Vue) eCommerce site with WooCommerce backend
Stars: ✭ 83 (+207.41%)
Mutual labels:  algolia
eslint-config-mingelz
A shared ESLint configuration with Chinese comments. 一份带有完整中文注释的 ESLint 规则。
Stars: ✭ 15 (-44.44%)
Mutual labels:  eslint-config

eslint-config-algolia

Version Build Status License Downloads

This is Algolia's linting and formatting of JavaScript projects (Vanilla, React, Vue) repository.

It explains to you how to setup your project to use it and never worry again about indentation, curly spaces, let vs const etc...

This code style is only as useful as you activate travis for your project so that it runs linting in your test phase and warns you.

Just focus on coding.

Table of Contents

Setup your project

Base requirements

yarn add \
eslint @babel/eslint-parser prettier \
eslint-config-algolia eslint-config-prettier \
eslint-plugin-import eslint-plugin-prettier \
eslint-plugin-eslint-comments eslint-plugin-jsdoc \
--dev

Vanilla

.eslintrc.js

module.exports = {
  extends: 'algolia'
};

package.json

{
  "scripts": {
    "test": "npm run lint",
    "lint": "eslint .",
    "lint:fix": "npm run lint -- --fix"
  }
}

Jest

We recommend using Jest as a test runner.

terminal

yarn add eslint-plugin-jest --dev

.eslintrc.js

module.exports = {
  extends: ['algolia', 'algolia/jest']
};

package.json

{
  "scripts": {
    "test": "npm run lint",
    "lint": "eslint .",
    "lint:fix": "npm run lint -- --fix"
  }
}

React

terminal

yarn add eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y --dev

.eslintrc.js

module.exports = {
  extends: ['algolia', 'algolia/react']
};

package.json

{
  "scripts": {
    "test": "npm run lint",
    "lint": "eslint .",
    "lint:fix": "npm run lint -- --fix"
  }
}

Flow

terminal

yarn add eslint-plugin-flowtype --dev

.eslintrc.js

module.exports = {
  extends: ['algolia', 'algolia/flowtype']
};

Flow with React

terminal

yarn add eslint-plugin-flowtype eslint-plugin-react eslint-plugin-react-hooks --dev

.eslintrc.js

module.exports = {
  extends: ['algolia', 'algolia/flowtype', 'algolia/react']
};

package.json

{
  "scripts": {
    "test": "npm run lint",
    "lint": "eslint .",
    "lint:fix": "npm run lint -- --fix"
  }
}

TypeScript

terminal

yarn add @typescript-eslint/parser @typescript-eslint/eslint-plugin typescript --dev

.eslintrc.js

module.exports = {
  extends: ['algolia', 'algolia/typescript']
};

package.json

{
  "scripts": {
    "test": "npm run lint",
    "lint": "eslint --ext .js,.ts,.tsx .",
    "lint:fix": "npm run lint -- --fix"
  }
}

TypeScript with React

terminal

yarn add @typescript-eslint/parser @typescript-eslint/eslint-plugin typescript eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y --dev

.eslintrc.js

module.exports = {
  extends: ['algolia', 'algolia/react', 'algolia/typescript']
};

Note: Be sure to put the algolia/typescript configuration last so the parser is properly set for TypeScript files.

package.json

{
  "scripts": {
    "test": "npm run lint",
    "lint": "eslint --ext .js,.ts,.tsx .",
    "lint:fix": "npm run lint -- --fix"
  }
}

Vue

terminal

yarn add eslint-plugin-vue --dev

.eslintrc.js

module.exports = {
  extends: ['algolia', 'algolia/vue']
};

package.json

{
  "scripts": {
    "test": "npm run lint",
    "lint": "eslint --ext .js,.vue .",
    "lint:fix": "npm run lint -- --fix"
  }
}

VSCode

{
  "eslint.validate": [
    {
      "language": "vue",
      "autoFix": true
    }
  ]
}

Node.js

package.json

{
  "scripts": {
    "test": "npm run lint",
    "lint": "eslint .",
    "lint:fix": "npm run lint -- --fix"
  }
}

.eslintrc.js

module.exports = {
  extends: 'algolia',
  rules: {
    'import/no-commonjs': 'off'
  }
};

Existing codebase setup

If you have a lot of files already written and wants to now use our linting tools, you might have a lot of errors. There's hope!

Just reformat all the files automatically and then manually fix remaining errors.

terminal

npm run lint:fix

Setup autofix in IDE

Don't overlook this part, autofixing on save is a huge productivity boost.

Use any ESLint integration and activate "Fix on save" option.

Also activate "Lint HTML files" when dealing with .vue components.

Ignoring files

See "Ignoring Files and Directories" on ESLint website.

Contributing

Test

We have a sample-project.

yarn test

Release

npm run release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].