Giter VIP home page Giter VIP logo

comparto-eslint-config's Introduction

actions version downloads Code Coverage semantic-release code style: prettier

@comparto/eslint-config

This package provides a shareable ESLint configuration with rules for react, typescript, javascript, jest, and @testing-library.

Usage:

This will enable jest, react, typescript or @testing-library rules if their respective dependency exists.

  1. Install stuff:

    npx install-peerdeps --dev @comparto/eslint-config

    or if you wish this to be a common dependency in a yarn workspaces monorepo:

    # -Y --yarn, -x --extra-args, -W --ignore-workspace-root-check
    npx install-peerdeps @comparto/eslint-config --dev -Y -x -W
  2. Add "extends": "@comparto/eslint-config" to your .eslintrc

Prettier:

yarn add -D @comparto/prettier-config

Add "prettier": "@comparto/prettier-config" to your package.json or any configuration of your choice.

Using webpack aliases?

This config uses eslint-import-resolver-webpack with a default setting of:

settings:
  import/resolver:
    webpack:
      config: 'webpack.dev.config.js' # or {} if not found

This can be overridden exactly the same as the eslint-import-resolver-webpack configuration.

Using typescript?

This config uses some rules that require type information like naming-convention, so @typescript-eslint/parser's parserOptions.project is set to "./tsconfig.json". Override this value if your tsconfig.json is located somewhere else.

comparto-eslint-config's People

Contributors

dependabot[bot] avatar jimmy-guzman avatar semantic-release-bot avatar

Watchers

 avatar

comparto-eslint-config's Issues

Decouple prettier

Describe the feature you'd like:

I would like to see prettier be it's own module @comparto/eslint-config

Suggested implementation:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

Definition for some rules are not found

  • @comparte/eslint-config version: 1.1.0
  • eslint version:
  • typescript version:
  • node version:

Relevant code or config:

  1:1  error  Definition for rule '@typescript-eslint/ban-ts-ignore' was not found          @typescript-eslint/ban-ts-ignore
  1:1  error  Definition for rule '@typescript-eslint/camelcase' was not found              @typescript-eslint/camelcase
  1:1  error  Definition for rule '@typescript-eslint/class-name-casing' was not found      @typescript-eslint/class-name-casing
  1:1  error  Definition for rule '@typescript-eslint/interface-name-prefix' was not found  @typescript-eslint/interface-name-prefix

What you did:

What happened:

Reproduction:

Problem description:

Suggested solution:

Update to

    "@typescript-eslint/eslint-plugin": "^3.4.0",
    "@typescript-eslint/parser": "^3.4.0",

And replace deprecated rules

typescript naming patterns do not support React completely

  • @comparte/eslint-config version: 5.0.0
  • eslint version: 7.14.0
  • typescript version: 3.9.5
  • node version:

Relevant code or config:

const MyComponent = (): JSX.Element => <>Hi</>

What you did:

yarn eslint . --ext js,jsx,ts,tsx

What happened:

Variable name `MyComponent` must match one of the following formats: camelCase, UPPER_CASEeslint@typescript-eslint/naming-convention
```bash
### Reproduction:

### Problem description:

### Suggested solution:
Allo `PascalCase`

more rules

Describe the feature you'd like:

enhanced error, best practices, react rules

Suggested implementation:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

more import rules

Describe the feature you'd like:

Suggested implementation:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

has unmet peer dependency "webpack@>=1.11.0".

  • @comparte/eslint-config version:
  • eslint version:
  • typescript version:
  • node version:

Relevant code or config:

const your => code => here

What you did:

What happened:

Reproduction:

Problem description:

Suggested solution:

`parseForESLint` from parser error when project has both javascript and typrescript

  • @comparte/eslint-config version: 5.0.0
  • eslint version: 7.14.0
  • typescript version: 3.95.0
  • node version: 14

Relevant code or config:

export interface AppRoute {
  route: string
  componentName: string
  exact: boolean
}

What you did:

eslint . --ext js,jsx,ts,tsx

What happened:

`parseForESLint` from parser `/app/node_modules/babel-eslint/lib/index.js` is invalid and will just be ignored

Oops! Something went wrong! :(

ESLint: 7.14.0

AssertionError [ERR_ASSERTION]: Node must be provided when reporting error if location is not provided
    at assertValidNodeInfo (/app/node_modules/eslint/lib/linter/report-translator.js:98:9)
    at /app/node_modules/eslint/lib/linter/report-translator.js:315:9
    at Object.report (/app/node_modules/eslint/lib/linter/linter.js:920:41)
    at Program:exit (/app/node_modules/@typescript-eslint/eslint-plugin/node_modules/eslint/lib/rules/no-unused-vars.js:596:33)
    at /app/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/app/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/app/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/app/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.leaveNode (/app/node_modules/eslint/lib/linter/node-event-generator.js:306:14)
error Command failed with exit code 2.

Reproduction:

Problem description:

Suggested solution:

These setting should not be applied through overrides, since eslint-plugin-import scans holistically

      settings: {
        'import/external-module-folders': [
          'node_modules',
          'node_modules/@types'
        ],
        'import/parsers': {
          '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts']
        }
      }

add npm keywords

Describe the feature you'd like:

I would like to see npm keywords

Suggested implementation:

{
  "keywords": [
    "eslint",
    "eslint-shareeable-config"
  ],
}

Describe alternatives you've considered:

N/A

Teachability, Documentation, Adoption, Migration Strategy:

jest globals are not applied

  • @comparte/eslint-config version: 1.0.1
  • eslint version:
  • typescript version:
  • node version:

Relevant code or config:

What you did:

What happened:

error: 'jest' is not defined

Reproduction:

Problem description:

Suggested solution:

  env: {
    'jest/globals': true
  },

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Expected 'this' to be used by class method 'componentDidMount'

  • @comparte/eslint-config version: 5.0.0
  • eslint version:
  • typescript version:
  • node version:

Relevant code or config:

export class Modal extends React.Component {
  componentDidMount() {
    noScroll.on()
  }

What you did:

What happened:

Reproduction:

Problem description:

Suggested solution:

jest esling configuration is not exposed

  • @comparte/eslint-config version:
  • eslint version:
  • typescript version:
  • node version:

Relevant code or config:

const your => code => here

What you did:

What happened:

Reproduction:

Problem description:

Suggested solution:

Added coverage reporting

Describe the feature you'd like:

I would like to see a badge that displays coverage percentage

Suggested implementation:

codecov

Describe alternatives you've considered:

coveralls

Teachability, Documentation, Adoption, Migration Strategy:

add module import order rules

Describe the feature you'd like:

I would like to see rules the prescribe import order

Suggested implementation:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

add yarn workspaces install documentation

Describe the feature you'd like:

Too see yarn workspaces installation

Suggested implementation:

npx install-peerdeps @comparto/eslint-config --dev --yarn --extra-args -W

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

Add @typescript/eslint unused rules

Describe the feature you'd like:

Unused Rules

  • @typescript-eslint/array-type
  • @typescript-eslint/await-thenable
  • @typescript-eslint/ban-tslint-comment
  • @typescript-eslint/class-literal-property-style
  • @typescript-eslint/consistent-indexed-object-style
  • @typescript-eslint/consistent-type-assertions
  • @typescript-eslint/consistent-type-definitions
  • @typescript-eslint/consistent-type-imports
  • @typescript-eslint/default-param-last
  • @typescript-eslint/dot-notation
  • @typescript-eslint/explicit-function-return-type
  • @typescript-eslint/explicit-member-accessibility
  • @typescript-eslint/init-declarations
  • @typescript-eslint/lines-between-class-members
  • @typescript-eslint/member-ordering
  • @typescript-eslint/method-signature-style
  • @typescript-eslint/no-base-to-string
  • @typescript-eslint/no-confusing-non-null-assertion
  • @typescript-eslint/no-confusing-void-expression
  • @typescript-eslint/no-dupe-class-members
  • @typescript-eslint/no-duplicate-imports
  • @typescript-eslint/no-dynamic-delete
  • @typescript-eslint/no-extraneous-class
  • @typescript-eslint/no-floating-promises
  • @typescript-eslint/no-for-in-array
  • @typescript-eslint/no-implicit-any-catch
  • @typescript-eslint/no-implied-eval
  • @typescript-eslint/no-invalid-this
  • @typescript-eslint/no-invalid-void-type
  • @typescript-eslint/no-loop-func
  • @typescript-eslint/no-loss-of-precision
  • @typescript-eslint/no-magic-numbers
  • @typescript-eslint/no-misused-promises
  • @typescript-eslint/no-parameter-properties
  • @typescript-eslint/no-redeclare
  • @typescript-eslint/no-require-imports
  • @typescript-eslint/no-throw-literal
  • @typescript-eslint/no-type-alias
  • @typescript-eslint/no-unnecessary-boolean-literal-compare
  • @typescript-eslint/no-unnecessary-condition
  • @typescript-eslint/no-unnecessary-qualifier
  • @typescript-eslint/no-unnecessary-type-arguments
  • @typescript-eslint/no-unnecessary-type-assertion
  • @typescript-eslint/no-unnecessary-type-constraint
  • @typescript-eslint/no-unsafe-assignment
  • @typescript-eslint/no-unsafe-call
  • @typescript-eslint/no-unsafe-member-access
  • @typescript-eslint/no-unsafe-return
  • @typescript-eslint/no-unused-expressions
  • @typescript-eslint/no-use-before-define
  • @typescript-eslint/no-useless-constructor
  • @typescript-eslint/prefer-enum-initializers
  • @typescript-eslint/prefer-for-of
  • @typescript-eslint/prefer-function-type
  • @typescript-eslint/prefer-includes
  • @typescript-eslint/prefer-literal-enum-member
  • @typescript-eslint/prefer-nullish-coalescing
  • @typescript-eslint/prefer-optional-chain
  • @typescript-eslint/prefer-readonly
  • @typescript-eslint/prefer-readonly-parameter-types
  • @typescript-eslint/prefer-reduce-type-parameter
  • @typescript-eslint/prefer-regexp-exec
  • @typescript-eslint/prefer-string-starts-ends-with
  • @typescript-eslint/prefer-ts-expect-error
  • @typescript-eslint/promise-function-async
  • @typescript-eslint/require-array-sort-compare
  • @typescript-eslint/require-await
  • @typescript-eslint/restrict-plus-operands
  • @typescript-eslint/restrict-template-expressions
  • @typescript-eslint/return-await
  • @typescript-eslint/strict-boolean-expressions
  • @typescript-eslint/switch-exhaustiveness-check
  • @typescript-eslint/typedef
  • @typescript-eslint/unbound-method
  • @typescript-eslint/unified-signatures

Suggested implementation:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

more jest rules

Describe the feature you'd like:

Suggested implementation:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

Lint commits on CI

Describe the feature you'd like:

Suggested implementation:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

"parserOptions.project" is not

  • @comparte/eslint-config version: 1.1.1
  • eslint version:7.3.1
  • typescript version: 3.9.5
  • node version:

Relevant code or config:

const your => code => here

What you did:

What happened:

Error: You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.

Reproduction:

Problem description:

Suggested solution:

prettier docs are not correct

  • @comparte/eslint-config version:
  • eslint version:
  • typescript version:
  • node version:

Problem description:

Suggested solution:

in README.md
yarn add -D @comparto/eslint-config should be yarn add -D @comparto/prettier-config

Contradicting eslint rules

  • @comparte/eslint-config version: 4.0.0
  • eslint version: 7.5.0
  • typescript version: 3.3
  • node version: 13

Relevant code or config:

  1:36  error  Missing file extension for "./types"        import/extensions
  1:36  error  Unable to resolve path to module './types'  import/no-unresolved

What you did:

What happened:

Reproduction:

https://github.com/comparto/git-c/blob/master/package.json#L17

Problem description:

Suggested solution:

settings:
  'import/resolver':
    node:
      extensions: ['.ts', '.tsx']

apply prettier to everything

Describe the feature you'd like:

prettier rules being applied to .json, .md

Suggested implementation:

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

error based rules are not included

  • @comparte/eslint-config version:
  • eslint version:
  • typescript version:
  • node version:

Relevant code or config:

const your => code => here

What you did:

What happened:

Reproduction:

Problem description:

Suggested solution:

'React' was used before it was defined in typescript

  • @comparte/eslint-config version:
  • eslint version:
  • typescript version:
  • node version:

Relevant code or config:

import React from 'react'

What you did:

What happened:

error: 'React' was used before it was defined in typescript

Reproduction:

Problem description:

Suggested solution:

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.