Closed amritk closed 4 years ago
I have the same problem. Autofix in TypeScript files seems to remove the function.
Thank you for the report. I have never tried the plugin on a TypeScript file. I'll write some tests using the @typescript-eslint/parser and see if I can replicate this issue.
Also came across the same issue, any progress ?
export function dummyFunction(testString: string):string {
return testString;
}
replaced with
export ;
index.js
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:sonarjs/recommended',
'plugin:jsdoc/recommended',
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['prefer-arrow', 'import', '@typescript-eslint', 'sonarjs', 'jsdoc'],
rules: {
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-ignore': 'warn',
'@typescript-eslint/camelcase': [
'error',
{
properties: 'never',
ignoreDestructuring: true,
},
],
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
},
],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public',
},
],
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/semi': ['off', null],
'@typescript-eslint/space-within-parens': ['off', 'never'],
'@typescript-eslint/typedef': [
'error',
{
arrayDestructuring: false,
arrowParameter: false,
memberVariableDeclaration: false,
objectDestructuring: false,
parameter: false,
propertyDeclaration: true,
variableDeclaration: false,
},
],
'arrow-body-style': 'error',
'arrow-parens': ['off', 'as-needed'],
curly: 'error',
eqeqeq: ['error', 'smart'],
'handle-callback-err': 'error',
'id-blacklist': ['error', 'any', 'Number', 'number', 'String', 'string', 'Boolean', 'boolean', 'Undefined', 'undefined'],
'id-match': 'error',
'import/no-deprecated': 'warn',
'import/no-unassigned-import': 'error',
'import/order': 'error',
'jsdoc/require-jsdoc': 'warn',
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns': 'off',
'no-caller': 'error',
'no-console': 'error',
'no-duplicate-imports': 'error',
'no-eval': 'error',
'no-invalid-this': 'error',
'no-new-wrappers': 'error',
'no-proto': 'error',
'no-script-url': 'error',
'no-self-compare': 'error',
'no-unneeded-ternary': 'error',
'no-return-await': 'error',
'no-sequences': 'error',
'no-shadow': [
'warn',
{
hoist: 'all',
},
],
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-undef-init': 'error',
'no-undefined': 'error',
'no-underscore-dangle': ['error', { allowAfterThis: true }],
'no-unused-expressions': [
'error',
{
allowShortCircuit: true,
},
],
'object-shorthand': 'error',
'one-var': ['off', 'never'],
'prefer-arrow-callback': 'off',
'prefer-arrow/prefer-arrow-functions': [
'warn',
{
disallowPrototype: false,
singleReturnOnly: true,
classPropertiesAllowed: true,
},
],
radix: 'error',
},
};
Sorry this took me a while, but this should be fixed in https://github.com/TristonJ/eslint-plugin-prefer-arrow/commit/00ac120a12bdf95d34ba09d18d96c1f3c4d8dedf and available in version 1.1.7 of the npm package.
If there are any further issues with typescript & this plugin, feel free to open another issue.
There seems to be a strange bug here, this is on a typescript file. It fixes this: