Git Product home page Git Product logo

Comments (8)

tinymins avatar tinymins commented on May 18, 2024 4

image

"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-import-resolver-webpack": "^0.11.1",
"eslint-loader": "^2.1.2",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-vue": "^5.2.2",

from typescript-eslint.

aldarund avatar aldarund commented on May 18, 2024 2

Still issue. It happens when { "requireForBlockBody": true } otherwise it don't happen.
Maybe it will be fixed one day :) Issue number 14. Is it oldest one not fixed i wonder
happens on latest eslint 7 and the fix action totally break code

from typescript-eslint.

mdjermanovic avatar mdjermanovic commented on May 18, 2024 1

This is fixed in eslint v7.4.0

from typescript-eslint.

jhoch avatar jhoch commented on May 18, 2024

@JamesHenry @armano2 I'm still seeing this on version 1.4.2. I have a file in my repo called components/util/test.ts:

const foo = <T>(bar: any): void => {
  // Do nothing
}

which produces the following when I run eslint:

jasonhoch@hoch1:~/code/newfront-app
15:34:48$ yarn eslint components/util/test.ts
yarn run v1.13.0
$ /Users/jasonhoch/code/newfront-app/node_modules/.bin/eslint components/util/test.ts

/Users/jasonhoch/code/newfront-app/components/util/test.ts
  1:7   warning  'foo' is assigned a value but never used                                             @typescript-eslint/no-unused-vars
  1:13  error    Expected parentheses around arrow function argument having a body with curly braces  arrow-parens
  1:17  warning  'bar' is defined but never used                                                      @typescript-eslint/no-unused-vars
  1:22  warning  Unexpected any. Specify a different type                                             @typescript-eslint/no-explicit-any
  3:2   error    Missing semicolon                                                                    semi

✖ 5 problems (2 errors, 3 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

(See the error at 1:13). Here is my .eslintrc.js file:

module.exports = {
    'extends': [
      'airbnb',
      'plugin:@typescript-eslint/recommended',
    ],
    'env': {
      'jest': true,
    },
    'overrides': [{
      'files': ['*.ts', '*.tsx'],
      'rules': {
        'indent': 'off', // Conflicts
        'semi': ['error', 'always'], // Conflicts
      },
    }],
    'parser': '@typescript-eslint/parser',
    'parserOptions': {
      'project': './tsconfig.json',
    },
    'plugins': [
      '@typescript-eslint',
      'import',
    ],
    'rules': {
      'arrow-body-style': ['off'],
      'jsx-a11y/anchor-is-valid': ['error', {
        'components': ['Link'],
        'aspects': ['invalidHref', 'preferButton'],
      }],
      'jsx-quotes': ['warn', 'prefer-single'],
      'react/jsx-filename-extension': ['warn', { 'extensions': ['.js', '.jsx', '.tsx'] }],
      'react/jsx-closing-tag-location': ['off'],
      'react/jsx-curly-brace-presence': ['error', { 'props': 'never', 'children': 'ignore' } ],
      'react/jsx-one-expression-per-line': ['off'],
      'react/prop-types': ['off'],
      'semi': ['warn', 'never'],
      '@typescript-eslint/explicit-function-return-type': ['warn', { 'allowExpressions': true }],
      '@typescript-eslint/indent': ['error', 2],
    },
    'settings': {
      'import/resolver': {
        'typescript': {},
      },
    },
}

and the lines in my package.json:

"devDependencies": {
    ...
    "@typescript-eslint/eslint-plugin": "^1.4.2",
    "@typescript-eslint/parser": "^1.4.2",
    ...
}

We've had a smooth experience moving over from TSLint, with this one glitch. Looking at #176, it looks like you guys test for this case. Any idea what the problem could be? Let me know if I can help!

from typescript-eslint.

jinasonlin avatar jinasonlin commented on May 18, 2024

I still get false positive.

@typescript-eslint/parser version

1.7.1-alpha-28

rule

"arrow-parens" : ["as-needed", { "requireForBlockBody": true }]

// Expected parentheses around arrow function argument having a body with curly braces.eslint(arrow-parens)
const foo = <T>(t: T): void => { console.info(t); }

// the following is correct
const foo = (t) => { console.info(t); }

from typescript-eslint.

bradzacher avatar bradzacher commented on May 18, 2024

You have the missing piece of the puzzle!
The config that causes it to fail!

from typescript-eslint.

tinymins avatar tinymins commented on May 18, 2024

I've the same problem, when will this problem get fixed and published?

from typescript-eslint.

oli-laban avatar oli-laban commented on May 18, 2024

I'm also experiencing this with default airbnb arrow-parens config:

'arrow-parens': ['error', 'as-needed', {
  requireForBlockBody: true,
}],
// Expected parentheses around arrow function argument having a body with curly braces.
export const makeRequest = async <T>(
  method: RequestMethod,
  urlPath: string,
  body: {} = {},
  extraHeaders: RequestHeaders = {},
  throwGeneralError: boolean = true,
  suppressErrors: boolean = false,
): Promise<T | null> => {
  ...
};
"eslint": "^5.15.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",

from typescript-eslint.

Related Issues (20)

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.