Code Monkey home page Code Monkey logo

linters's Introduction

linters's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linters's Issues

[feature] Angular-eslint for Taiga-UI

module.exports = {
    overrides: [
        {
            files: ['*.ts'],
            plugins: ['@angular-eslint/eslint-plugin'],
            rules: {
                '@angular-eslint/component-selector': 'error',
                '@angular-eslint/contextual-decorator': 'error',
                '@angular-eslint/contextual-lifecycle': 'error',
                '@angular-eslint/directive-class-suffix': 'error',
                '@angular-eslint/directive-selector': 'error',
                '@angular-eslint/no-conflicting-lifecycle': 'error',
                '@angular-eslint/no-empty-lifecycle-method': 'error',
                '@angular-eslint/no-output-native': 'error',
                '@angular-eslint/no-output-on-prefix': 'error',
                '@angular-eslint/no-queries-metadata-property': 'error',
                '@angular-eslint/pipe-prefix': 'error',
                '@angular-eslint/prefer-on-push-component-change-detection': 'error',
                '@angular-eslint/prefer-output-readonly': 'error',
                '@angular-eslint/relative-url-prefix': 'error',
                '@angular-eslint/use-lifecycle-interface': 'error',
                '@angular-eslint/use-pipe-transform-interface': 'error',
                // off
                '@angular-eslint/no-forward-ref': 'off',
                '@angular-eslint/no-pipe-impure': 'off',
                '@angular-eslint/no-lifecycle-call': 'off',
                '@angular-eslint/no-host-metadata-property': 'off',
                '@angular-eslint/sort-ngmodule-metadata-arrays': 'off',
                '@angular-eslint/use-injectable-provided-in': 'off',
                '@angular-eslint/no-output-rename': 'off',
                '@angular-eslint/use-component-view-encapsulation': 'off',
                '@angular-eslint/no-attribute-decorator': 'off',
                '@angular-eslint/no-input-prefix': 'off',
                '@angular-eslint/no-input-rename': 'off',
                '@angular-eslint/no-inputs-metadata-property': 'off',
                '@angular-eslint/no-outputs-metadata-property': 'off',
                '@angular-eslint/component-class-suffix': 'off',
                '@angular-eslint/use-component-selector': 'off',
                '@angular-eslint/prefer-on-push-component-change-detection': 'off',
                '@angular-eslint/component-max-inline-declarations': 'off',
            },
        },
        {
            files: ['*.html'],
            parser: '@angular-eslint/template-parser',
            plugins: ['html', '@angular-eslint/template'],
            extends: ['plugin:@angular-eslint/template/recommended'],
            rules: {
                '@angular-eslint/template/accessibility-alt-text': 'error',
                '@angular-eslint/template/accessibility-elements-content': 'error',
                '@angular-eslint/template/accessibility-label-for': 'error',
                '@angular-eslint/template/accessibility-label-has-associated-control':
                    'error',
                '@angular-eslint/template/accessibility-table-scope': 'error',
                '@angular-eslint/template/accessibility-valid-aria': 'error',
                '@angular-eslint/template/banana-in-box': 'error',
                '@angular-eslint/template/eqeqeq': 'error',
                '@angular-eslint/template/mouse-events-have-key-events': 'error',
                '@angular-eslint/template/no-autofocus': 'error',
                '@angular-eslint/template/no-call-expression': 'error',
                '@angular-eslint/template/no-distracting-elements': 'error',
                '@angular-eslint/template/no-duplicate-attributes': 'error',
                '@angular-eslint/template/no-negated-async': 'error',
                '@angular-eslint/template/no-positive-tabindex': 'error',
                '@angular-eslint/template/no-any': 'error',
                // off
                '@angular-eslint/template/use-track-by-function': 'error',
                '@angular-eslint/template/click-events-have-key-events': 'off',
                '@angular-eslint/template/conditional-complexity': 'off',
                '@angular-eslint/template/cyclomatic-complexity': 'off',
                '@angular-eslint/template/i18n': 'off',
                'max-len': 'off', // use prettier
            },
        },
    ],
};

Attributes sort order

🚀 Feature request

Attributes sort order

Description

*attr
#attr
attr
[attr]
[(attr)]
(attr)

Example

<div
    *ngIf="predicate"
    #block
    class="classname"
    [model]="model"
    (click)="onClick()"
></div>

[eslint config] Eslint fails if tsconfig extends multiple files

Typescript v5 introduced the feature that allows to extend from multiple tsconfig files, e.g

{
  "extends": ["@tinkoff/typescript-config/tsconfig.base", "@tsconfig/node16/tsconfig.json"],
  "compilerOptions": {}
  ...
}

If a project uses such tsconfig.json, the eslint fails with error

Oops! Something went wrong! :(

ESLint: 8.45.0

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array
Occurred while linting "..."
Rule: "import/no-cycle"
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:162:11)
    at Object.join (node:path:1172:7)
   ...

There is an issue in eslint-plugin-import import-js/eslint-plugin-import#2751

I see 2 possible solutions:

  1. Since the author is not interested in solving the problem, we can migrate to eslint-plugin-i, which is actually fork of eslint-plugin-import with some improvements.
  2. Override the tsconfig-paths in package.json
  "overrides":{
    "tsconfig-paths": "^4.0.0"
  },

[feature] enable @typescript-eslint/member-ordering in @tinkoff/eslint-config

@typescript-eslint/member-ordering is disabled by default

And sort-class-members rules works for typescript code.

It is a problem, because eslint-plugin-sort-class-members didn't respect many typescript features.

Also, sort-class-members rules is very React class components specific.

Looks like we need to few changes:

  1. Update and enable @typescript-eslint/member-ordering rules for TS code
  2. Move React specific sort-class-members rules from @tinkoff/eslint-config to @tinkoff/eslint-config-react, only for js/jsx files

📅 - Roadmap 2021

1.0.0

  • Introducing eslint
  • Warnings about changes by new code style
  • Migration of tinkoff- rules natively to eslint

1.1.0

  • Same errors (backwards compatible) and new warnings for angular and rxjs

2.0.0

  • Completely removing tslint rules and configs
  • Warnings from v1.* turns into errors in accordance with new code style, angular and rxjs
  • Warnings about more strict rules in accordance to best-practices (sonarjs, optimize-regex, no-use-before-define, etc)

Hacktoberfest 2022

About

Hacktoberfest is DigitalOcean's annual event that encourages people to contribute to Open Source projects. In short, each participant must make four contributions to OSS in order to receive one of two prizes: a personalized planted tree or a Hacktoberfest T-shirt.

Junior Level

  • Fix issue in documentation #201
  • Fix bug TypeError: Cannot read property 'type' of undefined #115

Middle Level

  • Add unicorn plugin as sub-plugin to @tinkoff/eslint-config-angular
  • Add unit test with combination ['@tinkoff/eslint-config/app', '@tinkoff/eslint-config-angular']
  • Migrate to npm 7 for drop node.js 12 #121
  • Add stylelint-scss package with some rules to @tinkoff/stylelint-config https://www.npmjs.com/package/stylelint-scss
  • Warnings about more strict rules in accordance to best-practices (sonarjs, optimize-regex, no-use-before-define, etc) in @tinkoff/eslint-config

High Level

  • Migrate from ESLint 7 to ESLint 8
  • Add @angular-eslint plugin to @tinkoff/eslint-config-angular #163
  • Completely removing tslint rules and configs
  • Support all typescript rules in @tinkoff/eslint-config-angular:
Rules ["adjacent-overload-signatures","array-type","await-thenable","ban-ts-comment","ban-tslint-comment","ban-types","brace-style","camelcase","class-literal-property-style","comma-dangle","comma-spacing","consistent-generic-constructors","consistent-indexed-object-style","consistent-type-assertions","consistent-type-definitions","consistent-type-exports","consistent-type-imports","default-param-last","dot-notation","explicit-function-return-type","explicit-member-accessibility","explicit-module-boundary-types","func-call-spacing","indent","init-declarations","keyword-spacing","lines-between-class-members","member-delimiter-style","member-ordering","method-signature-style","naming-convention","no-array-constructor","no-base-to-string","no-confusing-non-null-assertion","no-confusing-void-expression","no-dupe-class-members","no-duplicate-enum-values","no-duplicate-imports","no-dynamic-delete","no-empty-function","no-empty-interface","no-explicit-any","no-extra-non-null-assertion","no-extra-parens","no-extra-semi","no-extraneous-class","no-floating-promises","no-for-in-array","no-implicit-any-catch","no-implied-eval","no-inferrable-types","no-invalid-this","no-invalid-void-type","no-loop-func","no-loss-of-precision","no-magic-numbers","no-meaningless-void-operator","no-misused-new","no-misused-promises","no-namespace","no-non-null-asserted-nullish-coalescing","no-non-null-asserted-optional-chain","no-non-null-assertion","no-parameter-properties","no-redeclare","no-redundant-type-constituents","no-require-imports","no-restricted-imports","no-shadow","no-this-alias","no-throw-literal","no-type-alias","no-unnecessary-boolean-literal-compare","no-unnecessary-condition","no-unnecessary-qualifier","no-unnecessary-type-arguments","no-unnecessary-type-assertion","no-unnecessary-type-constraint","no-unsafe-argument","no-unsafe-assignment","no-unsafe-call","no-unsafe-member-access","no-unsafe-return","no-unused-expressions","no-unused-vars","no-use-before-define","no-useless-constructor","no-useless-empty-export","no-var-requires","non-nullable-type-assertion-style","object-curly-spacing","padding-line-between-statements","parameter-properties","prefer-as-const","prefer-enum-initializers","prefer-for-of","prefer-function-type","prefer-includes","prefer-literal-enum-member","prefer-namespace-keyword","prefer-nullish-coalescing","prefer-optional-chain","prefer-readonly-parameter-types","prefer-readonly","prefer-reduce-type-parameter","prefer-regexp-exec","prefer-return-this-type","prefer-string-starts-ends-with","prefer-ts-expect-error","promise-function-async","quotes","require-array-sort-compare","require-await","restrict-plus-operands","restrict-template-expressions","return-await","semi","sort-type-union-intersection-members","space-before-blocks","space-before-function-paren","space-infix-ops","strict-boolean-expressions","switch-exhaustiveness-check","triple-slash-reference","type-annotation-spacing","typedef","unbound-method","unified-signatures"]

Unexpected token '.' when parsing package.json

Description

Prettier fails on package.json with Unexpected token '.' error. It happens due to prettier-plugin-sort-package.js syntax (line 20, line 28) since old node versions can't work with these. Can you specify engines in package.json?

Reproduction

prettier package.json

Screenshot 2022-05-04 at 12 54 58

Environment

node 12
1.32.1

stylelint scss

can you learn how to quickly change stylelint to work with scss?

[feature] Support nx workspaces

Problem

Nx generate workspaces with eslint and prettier in dependencies.

@tinkoff/eslint-config has eslint and prettier in dependencies too, and recommends users to prevent install this packages.

So, it's easy to have missmatched versions or duplicates of this packages.

Solution

Looks like the best solution is move eslint, prettier and other core dependencies of @tinkoff/eslint-config to peerDependencies

Then we need to write a complete migration guider.

[bug] TypeError: Cannot read property 'type' of undefined

Reproduce

install dependencies:

npm i @tinkoff/eslint-config @tinkoff/eslint-config-react @tinkoff/eslint-plugin-tramvai

modyfy .eslintrc:

module.exports = {
    extends: [
        '@tinkoff/eslint-config/app',
        '@tinkoff/eslint-config/jest',
        '@tinkoff/eslint-config-react',
        'plugin:@tinkoff/tramvai/recommended',
    ],
    rules: {
        '@typescript-eslint/naming-convention': 1,
    },
};

add destructurisation in js file:

const x = ({ ...y }) => {}

Error

TypeError: Cannot read property 'type' of undefined
Occurred while linting /Users/b.ponomarenko/Desktop/es-app/index.js:1
    at getIdentifiersFromPattern (/Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:532:21)
    at /Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:553:21
    at Array.forEach (<anonymous>)
    at getIdentifiersFromPattern (/Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:544:32)
    at /Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:397:21
    at Array.forEach (<anonymous>)
    at FunctionDeclaration, TSDeclareFunction, FunctionExpression, ArrowFunctionExpression (/Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:392:29)
    at /Users/b.ponomarenko/Desktop/es-app/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/b.ponomarenko/Desktop/es-app/node_modules/eslint/lib/linter/safe-emitter.js:45:38)

Problem

Error only with enabled @typescript-eslint/naming-convention rule

Conditional prettier inclusion

Not all projects use a prettier. Is it possible to connect rules from a prettier by condition?

https://github.com/TinkoffCreditSystems/linters/blob/dd87c96e2a0af9e288160aef15b69daff774a80e/packages/eslint-config/index.js#L9

This extend removes some of the rules that a prettier can be responsible for. But if the project does not use a prettier, some of the rules are simply lost.

I propose to add a condition if a prettier is used in the project. I think it can be determined using this package.

If that's acceptable, I can make PR.

custom-property-pattern not compat with taiga vars

Into stylelint config contains rule custom-property-pattern, that dictate use only kebab case:

'custom-property-pattern': [
			'^([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
			{
				message: 'Expected custom property name to be kebab-case',
			},
		],

But taiga ui contains vars like --tui-text_body-m, obviously not match that pattern,

may custom-property-pattern needs to reconfigure for allowing all taiga vars?

Rules for HTML don't work if you extend @tinkoff/eslint-config-angular

Привет! Из-за экспортнутого html.js из '@tinkoff/eslint-config-angular' не получается использовать никакие правила для html, а в частности extends: ['plugin:@angular-eslint/template/recommended']. Возможно этот импорт как-то омитнуть? Возможно все ломается из-за того extends для .ts получает .html.

Для воспроизведения достаточно в overrides для files: ['*.ts'] в extends добавить '@tinkoff/eslint-config-angular'. тогда никакие правила для files: ['*.html'] не применяются

peerDependencies conflicts in @tinkoff/eslint-config-angular

When using v1.51.0 of @tinkoff/eslint-config-angular following errors are occurs

with eslint 7.x - requires a peer of eslint@^8.0.0 but none is installed
with eslint 8.x - requires a peer of eslint@^5.0.0 || ^6.0.0 || ^7.0.0 but none is installed.

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.