Unsure of what the issue is so feel free to change the title.
I tried to simplify this example as much as possible but anything I remove makes it work properly.
yarn tslint --fix testFile.tsx
import styled from 'styled-components';
import ModalImport from 'components/Modal';
import './MakerApp.scss';
import { Serialized } from 'services';
import { AppLoaded } from '@maker/events';
import { IBrand, IStringStringMap, IUser } from 'Types';
import Authorize from './Authorize';
import * as MakersPath from '@maker/paths';
import Brand from './Brand';
import Report from './Report';
import Api from '../Api';
const Modal: any = ModalImport;
interface IMakerAppPropTypes {}
const Scrollable = styled.div``;
class SomeClass {
stringMap: IStringStringMap;
scrollable = Scrollable;
model = Modal;
brand: IBrand;
iUser: IUser;
rsatyun: IMakerAppPropTypes;
handler = () => {
Serialized.updateEmployeeState();
AppLoaded.publish();
Authorize.bind(this);
Brand.bind(this);
Api.brandLead();
MakersPath.home();
Report.toLocaleString();
};
}
with tslint.json configuration:
{
"extends": ["tslint-react", "tslint-config-prettier"],
"rules": {
"ban": false,
"class-name": false,
"comment-format": [true, "check-space"],
"curly": true,
"eofline": false,
"forin": true,
"indent": [true, "spaces"],
"interface-name": [true, "always-prefix"],
"jsdoc-format": true,
"jsx-no-lambda": false,
"jsx-no-multiline-js": false,
"jsx-boolean-value": [true, "never"],
"label-position": true,
"member-ordering": false,
"no-any": false,
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"log",
"error",
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-consecutive-blank-lines": true,
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-duplicate-imports": true,
"no-empty": false,
"no-eval": true,
"no-return-await": true,
"no-shadowed-variable": true,
"no-string-literal": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": false,
"no-unused-variable": true,
"no-unused-expression": true,
"object-literal-shorthand": true,
"one-line": [
true,
"check-catch",
"check-else",
"check-open-brace",
"check-whitespace"
],
"ordered-imports": [
true,
{
"grouped-imports": true
}
],
"prefer-template": true,
"radix": true,
"switch-default": true,
"trailing-comma": [false],
"triple-equals": [true, "allow-null-check"],
"typedef": [true, "parameter", "property-declaration"],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-leading-underscore",
"allow-pascal-case",
"allow-snake-case"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-module",
"check-operator",
"check-separator",
"check-type",
"check-typecast"
]
},
"jsRules": {
"no-unused-expression": true
}
}
Deletes part of the code
noop formating
Not sure how abstract syntax tree works, but the mixing of colons and equals for value assignment in the creation of SomeClass are probably the problem. That's super invalid code, to the point at which it's probably invisible to the AST. Did the compiler catch that?
It is definitely valid typescript.
In typescript brand: IBrand; says that the this.brand is of type IBrand but does not define it.
First like of this class in the docs: https://www.typescriptlang.org/docs/handbook/classes.html
Yes, this is a bug. These lines are deleted:
const Modal: any = ModalImport;
interface IMakerAppPropTypes {}
const Scrollable = styled.div``;
...and replaced with:
le = styled.div``;
Unclear why. Related: #2556.
I had a very similar experience with a function that returned a promise:
return new Promise(....
was replaced with
turn; new Promise(...
TSLint is deprecated and no longer accepting pull requests other than security fixes. See #4534. โ ๏ธ
We recommend you instead use typescript-eslint to lint your TypeScript code with ESLint. โ
๐ It was a pleasure open sourcing with you!
๐ค Beep boop! ๐ TSLint is deprecated ๐ _(#4534)_ and you should switch to typescript-eslint! ๐ค
๐ This issue is being locked to prevent further unnecessary discussions. Thank you! ๐
Most helpful comment
๐ _It's time!_ ๐
TSLint is deprecated and no longer accepting pull requests other than security fixes. See #4534. โ ๏ธ
We recommend you instead use typescript-eslint to lint your TypeScript code with ESLint. โ
๐ It was a pleasure open sourcing with you!