Git Product home page Git Product logo

eslint-config-1's Introduction

eslint-config

npm version Test

A ESLint rule set for Toyokumo.

Purpose

  • Standardization of coding style.
  • Installation and setting support for ESLint.

Based on airbnb

  • Additional settings are not overwritten, merge into eslint-config-airbnb-base.
  • If we disagree with the rules of airbnb, we will not follow them.
  • This policy might be changed.

Differences

no-param-reassign rule is allowed for props.

const xs = [{ a: 1 }, { a: 2 }];
// ok
xs.forEach((x) => { x.a = 0 });

no-unused-vars rule is allowed for strings matched ^_+$.

// ok
const f = (_, x) => x;

named export is recommended over default export.

// bad
export default function foo() {}

// good
export function foo() {}

Use prettier for code format

  • All rules provided by toyokumo/eslint-config assume the use of prettier.
  • Use prettier-config-plugin to avoid lint errors where it overlaps with prettier format rules.
    • If we find a red squiggly line, we will want to fix it, but we don't have to manually fix what we can fix by formatting
  • For the lint + format method, refer to the method of this repository.
  • This policy might be changed.

Supporting rule sets

  • @toyokumo/eslint-config
    • Base rule set. At least use this.
  • @toyokumo/eslint-config/rules/typescript.js
    • Support of typescript for *.ts files.
  • @toyokumo/eslint-config/rules/vue2.js
    • Support of vue2 for *.vue files.
  • @toyokumo/eslint-config/rules/vue2-typescript.js
    • Support of vue2 with typescript in script tag for *.vue files.
  • @toyokumo/eslint-config/rules/jest.js
    • Support of jest.

Usage

We just set the ideal rule set, so we can overwrite or ignore the rule depending on the project situation.

module.exports = {
  extends: [
    '@toyokumo/eslint-config',
    '@toyokumo/eslint-config/rules/typescript.js',
    '@toyokumo/eslint-config/rules/vue2-typescript.js',
    '@toyokumo/eslint-config/rules/jest.js',
  ],
  rules: {
    // too many default export in project.
    'import/no-default-export': 'off',
  },
  overrides: [
    {
      files: '*.ts',
      rules: {
        // too many any in project.
        '@typescript-eslint/no-explicit-any': 'off',
      },
    },
    {
      files: '*.vue',
      rules: {
        // too many any in project.
        '@typescript-eslint/no-explicit-any': 'off',
      },
    },
  ],
};

eslint-config-1's People

Contributors

syunta avatar

Watchers

James Cloos 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.