sounisi5011/readme-generator

View on GitHub
.eslintrc.yaml

Summary

Maintainability
Test Coverage
extends:
  - eslint:recommended
  - plugin:import/recommended
  - plugin:import/errors
  - plugin:import/warnings
  - plugin:node/recommended-script
  - plugin:promise/recommended
  - standard
parserOptions:
  ecmaVersion: 2018
rules:
  import/newline-after-import: error
  import/no-extraneous-dependencies:
    - error
    - devDependencies:
        - "*"
        - ".*"
        - tests/**
  import/order:
    - error
    - groups:
        - builtin
        - [external, internal]
        - [parent, sibling, index]
        - unknown
      newlines-between: always
      alphabetize:
        order: asc
        caseInsensitive: true
overrides:
  - files: "*.js"
    extends:
      - plugin:dprint/recommended
    rules:
      dprint/dprint:
        - error
        - config: &dprint-config
            indentWidth: 2
            quoteStyle: preferSingle
            singleBodyPosition: sameLine
            typeParameters.trailingCommas: never
            arrowFunction.useParentheses: preferNone
            constructorType.spaceAfterNewKeyword: true
            taggedTemplate.spaceBeforeLiteral: false
            typeAssertion.spaceBeforeExpression: false
  - files: "*.ts"
    extends:
      - plugin:node/recommended-module
      - plugin:@typescript-eslint/recommended
      - plugin:import/typescript
      - standard-with-typescript
      - plugin:dprint/recommended
    parserOptions:
      sourceType: module
      project:
        - ./tsconfig.json
        - ./tests/tsconfig.json
        - ./tests/helpers/tsconfig.json
    settings:
      node:
        # see https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/shebang.md
        convertPath:
          src/**/*.ts:
            - ^src/(.+?)\.ts$
            - dist/$1.js
    rules:
      dprint/dprint:
        - error
        - config:
            <<: *dprint-config
            indentWidth: 4
      # TypeScript checks the import statement path.
      # Therefore, there is no need to verify the file path imported by ESLint.
      node/no-missing-import: off
      # The "node/no-unpublished-import" rule does not support "import type ... from '...'" statements.
      # This causes an error when importing a type definition file that is not published.
      node/no-unpublished-import: off
      # I don't want to use "nodeify" package.
      promise/no-callback-in-promise: off
      # The "@typescript-eslint/strict-boolean-expressions" rule is very strict and stressful.
      "@typescript-eslint/strict-boolean-expressions": off
  - files: "*.d.ts"
    rules:
      # The "no-redeclare" rule does not support namespace and function declarations of the same name.
      # example:
      #   declare function foo(): void;
      #   declare namespace foo { ... } // ESLint: error 'foo' is already defined
      # In addition, as of 2020/06/11, there is no alternative to the "no-redeclare" rule in "@typescript-eslint"
      no-redeclare: off
      # The "@ts-expect-error" comment is not allowed in TypeScript 3.8 or earlier.
      # If someone forks a type definition created in this project, the type definition will not be available in older versions of TypeScript.
      "@typescript-eslint/prefer-ts-expect-error": off
  - files:
      - tests/*.ts
      - tests/!(helpers!(?))*/*.ts
      - tests/!(helpers!(?))*/**/*.ts
    extends:
      - plugin:jest/recommended
      - plugin:jest/style
    rules:
      jest/consistent-test-it: error
      jest/lowercase-name: error
      jest/no-deprecated-functions: error
      jest/no-duplicate-hooks: error
      jest/no-if: error
      jest/no-test-return-statement: error
      jest/prefer-spy-on: error
      jest/prefer-strict-equal: error
      jest/prefer-todo: error
      jest/require-top-level-describe: error
      jest/valid-title: error