GithubHelp home page GithubHelp logo

isabella232 / eslint-plugin-square Goto Github PK

View Code? Open in Web Editor NEW

This project forked from square/eslint-plugin-square

0.0 0.0 0.0 1014 KB

An eslint plugin containing custom JavaScript, Ember, React, TypeScript rules and configurations tailored to Square's needs.

License: Apache License 2.0

JavaScript 100.00%

eslint-plugin-square's Introduction

eslint-plugin-square

npm version CI

This plugin contains lint rule definitions and configurations for ESLint specific to Square's needs. It serves mainly to consolidate Square's web frontend linting setup in one place.

Requirements

Usage

Install via yarn (or npm):

yarn add --dev eslint-plugin-square

Edit your .eslintrc.js configuration file to extend one of the available configurations from this plugin:

module.exports = {
  plugins: ['square'],
  extends: ['plugin:square/ember'], // Or other configuration.
};

Configurations

Name Description
base Rules and configuration for any JavaScript-based project. Includes recommended and optional rules from eslint, prettier, eslint-plugin-eslint-comments, eslint-plugin-import, eslint-plugin-unicorn, and more.
๐Ÿ”ฅ ember Ember.js-specific additions on top of base. Includes recommended and optional rules from eslint-plugin-ember, kebab-case filename enforcement with eslint-plugin-filenames, and more.
react React-specific additions on top of base.
typescript TypeScript-specific additions on top of base. Use with @typescript-eslint/parser.

Rules enabled by these configurations should meet the following criteria:

  • They make sense in a wide variety of codebases (and have been tested in a variety of Square's applications).
  • They are generally acceptable and desirable (in terms of enforcing best practices, consistency, avoiding bugs) to most developers.
  • There is a practical migration path (autofixers, codemod, find-and-replace, manual fixes) for enabling them in most applications.

Custom rules

Rule Category Config Fixable?
no-restricted-files JavaScript
require-await-function JavaScript ๐Ÿ”ฅ ๐Ÿ”ง
no-handlebar-interpolation Ember
no-modifying-immutable-properties Ember ๐Ÿ”ง
no-translation-key-interpolation Ember ๐Ÿ”ฅ
no-missing-tests Testing
no-test-return-value Testing ๐Ÿ”ฅ
use-call-count-test-assert Testing ๐Ÿ”ฅ ๐Ÿ”ง
no-assert-ok-find Ember Testing ๐Ÿ”ฅ
use-ember-find Ember Testing ๐Ÿ”ฅ ๐Ÿ”ง

Note that we prefer to upstream our custom lint rules to third-party eslint plugins whenever possible. The rules that still remain here are typically here because:

  • We haven't found the appropriate eslint plugin to upstream them to.
  • We haven't found the time to upstream them.
  • They are specific to Square in some way / not generic enough.

License

Copyright 2020 Square Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

eslint-plugin-square's People

Contributors

bmish avatar dependabot-preview[bot] avatar maxbeatty avatar ghaagsma avatar alexandersmanning avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.