interface Address {
street: string,
}
export const getAddress = (address: Address | null) : string =>
address?.street ? `${address?.street}`
: '0000 Default Dr';
Why am I receiving the error message
Parsing error: Expression expected. eslint
on address
in address?.street ?
? Any ideas?
Eslint rules are applied to both .js
and .ts
files:
{
"extends": [
"plugin:cypress/recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides":
{
"files": ["**/*.{ts,tsx}"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier", "react-hooks", "jsx-a11y"],
"extends": [
"eslint:recommended",
"react-app",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-shadow": "off",
"no-empty-function": 0,
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"]
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {}
},
"react": {
"version": "detect"
}
}
}
]
}