Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow-named-functions option #17

Open
snebjorn opened this issue Apr 14, 2020 · 5 comments · May be fixed by #31
Open

allow-named-functions option #17

snebjorn opened this issue Apr 14, 2020 · 5 comments · May be fixed by #31

Comments

@snebjorn
Copy link

typescript-eslint lists this plugin as the TSLint replacement for only-arrow-functions
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/ROADMAP.md

If that's the case then it's missing the allow-named-functions option
https://palantir.github.io/tslint/rules/only-arrow-functions/

I'd also very much appreciate a rule details page that describe why we would want to use the rule etc.
Much like typescript-eslint do
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md

@TristonJ
Copy link
Owner

I think both of those things are good suggestions. Documentation is certainly lacking.

Adding the additional option should be fairly easy. This might be an argument to change our allowStandaloneDeclarations to allowDeclarations and match whatever functionality that package exposes.

I'll work on this stuff and close / comment this issue when I have something.

@ahmedkotb
Copy link

@TristonJ @snebjorn any update on this ? :)

@rtruong
Copy link

rtruong commented Sep 18, 2020

@TristonJ @snebjorn Any updates?

@agataHappy
Copy link

@TristonJ I see that there's PR that should add this option. Can it be merged soon?

@Samuel-Therrien-Beslogic
Copy link

Samuel-Therrien-Beslogic commented Mar 8, 2022

For now I have an override in Angular that disables on classProperties in certain files

{
  // See no-restricted-syntax
  "files": ["*[.-]component.ts", "*[.-]interceptor.ts"],
  "rules": {
    // Angular hooks should be named functions
    // https://github.com/mojohaus/extra-enforcer-rules/issues/186
    "extra-rules/potential-point-free": "warn",
    "prefer-arrow/prefer-arrow-functions": [
      "error",
      {
        ...preferArrowFunctionsConfig,
        https://github.com/TristonJ/eslint-plugin-prefer-arrow/issues/17
        "classPropertiesAllowed": false,
      },
    ],
  },
},

But I would like to be able to tell this plugin to ignore:
intercept, ngOnChanges, ngOnInit, ngDoCheck, ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy, ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants