Comments (10)
Hi @filipekiss
Not a problem with eslint-loader
, if you remove eslint-loader
, same error happens, you need loader for typescript, try this:
// webpack.config.js
....
module: {
rules: [
{ enforce: 'pre', test: /\.ts$/, exclude: /node_modules/, loader: 'eslint-loader' },
{ test: /\.tsx?$/, loader: "ts-loader" },
],
},
...
from eslint-loader.
Hi @ricardogobbosouza, thank you for the explanation. It indeed worked when I added the ts-loader
rule. Do you have any idea why do I need it, though? This particular case I only want to use webpack to watch-lint files.
Thanks for the help, appreciated! Cheers!
from eslint-loader.
@filipekiss webpack does not handle typescript files. See https://webpack.js.org/guides/typescript/
You can use eslint-watch
from eslint-loader.
I mean, do I still need the TS Loader for the eslint-loader
in this case? Shouldn't eslint-loader
just pass this to eslint
and eslint
itself will handle the TypeScript stuff?
(I'll close the issue because this is more curiosity than an issue related to eslint-loader
. Thank you for your help!)
from eslint-loader.
@filipekiss using loader yes, you will need to add ts-loader
You can try using the plugin https://github.com/webpack-contrib/eslint-webpack-plugin
from eslint-loader.
Thank you, Ricardo! :D
from eslint-loader.
@ricardogobbosouza what is status of plugin? Any ETA wen we can deprecate loader in favor plugin?
from eslint-loader.
@evilebottnawi
The plugin was born very complete, but I need to make some adjustments, especially in the option lintDirtyModulesOnly
, unfortunately we still have few downloads and therefore few reports of use.
I think we can depreciate the loader as soon as webpack 5 as released
from eslint-loader.
@evilebottnawi I just released eslint-webpack-plugin v0.1.0
I think we can already recommend the plugin, but I still doubt about deprecating eslint-loader
from eslint-loader.
Edit: never mind I fixed issue! Thank you though :)
@ricardogobbosouza Hi Ricardo, I had a similar issue so I didn't want to open a new one.
When I use typescript 'as' keyword, causes eslint-loader to throw error on the 'as' - " Parsing error: Unexpected token, expected "," " even if I add ts-loader to config. If I remove eslint-loader completely, it works fine and no errors are thrown.
Example code of as usage:
const state = reactive({
testVariable: [] as Array<string>,
})
I do not get any other issues with typescript syntax such as const newName: string = 'hello'
currently using following:
- Operating System: linux(ubuntu)
- Node Version: v12.15
- NPM Version: v6.13.4
- webpack Version: v4.41.5
- eslint-loader Version: v3.0.2
In Nuxt environment
from eslint-loader.
Related Issues (20)
- TypeError: CLIEngine is not a constructor HOT 1
- Different lint results between webpack and cli HOT 1
- How to now fail the build on error or warning HOT 2
- Combining eslint-loader + vue + typescript causes the build to fail on the first run, but work on the second run HOT 2
- please update minimist due to prototype pollution (CVE-2020-7598) HOT 8
- Cannot read property 'range' of null HOT 3
- vscode integration
- exclude option not working. HOT 12
- Eslint-loader is not using .eslintrc.js configuration HOT 1
- failOnError option doesn't work with ts-loader and webpack-dev-server HOT 8
- CLIEngine has been deprecated HOT 1
- eslint-plugin-import fails to load properties with eslint-loader but works with stand alone eslint HOT 1
- Parsing error: Unexpected token .. HOT 1
- Cannot read property 'getFormatter' of undefined HOT 2
- Missing plugin referenced by .eslintrc file in ignored node_modules folder causes warning HOT 4
- Plugin "import" was conflicted HOT 2
- eslint-laoder failing the build even if the failOnError set to false HOT 2
- relative path is wrong when use eslint-loader in monorepo HOT 1
- Deprecate eslint-loader HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-loader.