palantir / tslint

:vertical_traffic_light: An extensible linter for the TypeScript language
http://palantir.github.io/tslint/
Apache License 2.0
5.91k stars 890 forks source link

Task crashes with big amount of errors #4520

Closed m-v-novikov closed 5 years ago

m-v-novikov commented 5 years ago

Bug Report

"tslint": "^5.12.1", "tslint-webpack-plugin": "^2.0.2", "typescript": "^3.3.3", "webpack": "^4.19.0",

TypeScript code being linted

const countries = ['Afghanistan','Albania','Algeria','Andorra','Angola','Antigua and Barbuda','Argentina','Armenia','Australia','Austria','Azerbaijan','The Bahamas','Bahrain','Bangladesh','Barbados','Belarus','Belgium','Belize','Benin','Bhutan','Bolivia','Bosnia and Herzegovina','Botswana','Brazil','Brunei','Bulgaria','Burkina Faso','Burundi','Cabo Verde','Cambodia','Cameroon','Canada','Central African Republic','Chad','Chile','China','Colombia','Comoros','Congo, Democratic  Republic of the','Congo, Republic of the','Costa Rica','Côte d’Ivoire','Croatia','Cuba','Cyprus','Czech Republic','Denmark','Djibouti','Dominica','Dominican Republic','East Timor','Ecuador','Egypt','El Salvador','Equatorial Guinea','Eritrea','Estonia','Ethiopia','Fiji','Finland','France','Gabon','The Gambia','Georgia','Germany','Ghana','Greece','Grenada','Guatemala','Guinea','Guinea-Bissau','Guyana','Haiti','Honduras','Hungary','Iceland','India','Indonesia','Iran','Iraq','Ireland','Israel','Italy','Jamaica','Japan','Jordan','Kazakhstan','Kenya','Kiribati','Korea, North','Korea, South','Kosovo','Kuwait','Kyrgyzstan','Laos','Latvia','Lebanon','Lesotho','Liberia','Libya','Liechtenstein','Lithuania','Luxembourg','Macedonia','Madagascar','Malawi','Malaysia','Maldives','Mali','Malta','Marshall Islands','Mauritania','Mauritius','Mexico','Micronesia,  Federated States of','Moldova','Monaco','Mongolia','Montenegro','Morocco','Mozambique','Myanmar','Namibia','Nauru','Nepal','Netherlands','New Zealand','Nicaragua','Niger','Nigeria','Norway','Oman','Pakistan','Palau','Panama','Papua New Guinea','Paraguay','Peru','Philippines','Poland','Portugal','Qatar','Romania','Russia','Rwanda','Saint Kitts and Nevis','Saint Lucia','Saint Vincent and  the Grenadines','Samoa','San Marino','Sao Tome and Principe','Saudi Arabia','Senegal','Serbia','Seychelles','Sierra Leone','Singapore','Slovakia','Slovenia','Solomon Islands','Somalia','South Africa','Spain','Sri Lanka','Sudan','Sudan, South','Suriname','Swaziland','Sweden','Switzerland','Syria','Taiwan','Tajikistan','Tanzania','Thailand','Togo','Tonga','Trinidad and Tobago','Tunisia','Turkey','Turkmenistan','Tuvalu','Uganda','Ukraine','United Arab Emirates','United Kingdom','United States','Uruguay','Uzbekistan','Vanuatu','Vatican City','Venezuela','Vietnam','Yemen','Zambia','Zimbabwe']

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /public/dist/
ℹ 「wds」: Content not from webpack is served from /home/mvnovikov/projects/user_search_widget/
ℹ 「wds」: 404s will fallback to /index.html
[tslint-plugin] Linting started in separate process...
undefined:1
[{"endPosition":{"character":41,"line":110,"position":3230},"failure":"missing whitespace","fix":{"innerStart":3229,"innerLength":0,"innerText":" "},"name":"src/js/components/common/layout/SearchUsersForm.tsx","ruleName":"whitespace","ruleSeverity":"ERROR","startPosition":{"character":40,"line":110,"position":3229}},{"endPosition":{"character":51,"line":110,"position":3240},"failure":"missing whitespace","fix":{"innerStart":3239,"innerLength":0,"innerText":" "},"name":"src/js/components/common/layout/SearchUsersForm.tsx","ruleName":"whitespace","ruleSeverity":"ERROR","startPosition":{"character":50,"line":110,"position":3239}},{"endPosition":{"character":61,"line":110,"position":3250},"failure":"missing whitespace","fix":{"innerStart":3249,"innerLength":0,"innerText":" "},"name":"src/js/components/common/layout/SearchUsersForm.tsx","ruleName":"whitespace","ruleSeverity":"ERROR","startPosition":{"character":60,"line":110,"position":3249}},{"endPosition":{"character":71,"line":110,"position":3260}

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Socket.linterProcess.stdout.on (/home/mvnovikov/projects/user_search_widget/node_modules/tslint-webpack-plugin/src/plugin.js:54:39)
    at Socket.emit (events.js:180:13)
    at addChunk (_stream_readable.js:274:12)
    at readableAddChunk (_stream_readable.js:261:11)
    at Socket.Readable.push (_stream_readable.js:218:10)
    at Pipe.onread (net.js:581:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! User-Search-Widget@1.0.0 dev-server: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the User-Search-Widget@1.0.0 dev-server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Actual behavior

I assume, when errors too much(like in example data - no whitespaces between items in the array), linter task crashes with an error: SyntaxError: Unexpected end of JSON input.

Expected behavior

Maybe don't crash task, and show first max counts messages(and ignore others, not show them when them too much)

JoshuaKGoldberg commented 5 years ago

@megamysterion it looks like the crash is happening within tslint-webpack-plugin. Does this issue happen if you lint with the tslint command on your terminal?

m-v-novikov commented 5 years ago

Sorry, I can't check. Maybe you right.

` sudo yarn global add tslint typescript [sudo] пароль для mvnovikov: yarn global v1.6.0 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... warning Your current version of Yarn is out of date. The latest version is "1.13.0", while you're on "1.6.0". info To upgrade, run the following command: $ sudo apt-get update && sudo apt-get install yarn success Installed "tslint@5.13.0" with binaries:

folder$ tslint -c tslint.json No files specified. Use --project to lint a project folder. folder$ tslint 'src/*/.ts?(x)' folder$ tslint 'src/js///*.ts?(x)' folder$ ls create_users helpers index.html jest.config.json package.json README.md src tslint.json webpack.config.js gruntfile.js icons.font.js jest.config.js node_modules package-lock.json server tsconfig.json webApp

folder$ tslint -c tslint.json 'src/js///*.ts'

` I install tslint globally, and it is don't do anything.

JoshuaKGoldberg commented 5 years ago

@megamysterion it looks like you might not be including any files in your tslint command; try this one?

tslint -c tslint.json src/**/*.tsx 

At any rate, since this looks like it isn't a problem with TSLint itself, closing this issue as external. You might want to file a bug on tslint-webpack-plugin.

If you're having problems running the globally installed tslint, feel free to ping me on Gitter!