eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.23k stars 867 forks source link

ESLINT not working when using with frontend-maven-plugin #911

Closed rubystar closed 4 years ago

rubystar commented 4 years ago

Hi,

i wanted to setup eslint with this plugin. My webpack setup looks like this:

const path = require('path');
const glob = require('glob');

module.exports = {
    ...
    },
    module:{
        rules: [
            {
                test: /\.(js|jsx)$/,
                exclude: /node_modules/,
                use: ['babel-loader', 'eslint-loader']
            },
            ...
        ]
    }
};

and i have .eslintrc at the root.

when i run npm run build (which is a script in package.json), it runs fine as expected

but when i run the same with this plugin, it has not affect.

[INFO] --- frontend-maven-plugin:1.9.1:install-node-and-npm (install node and npm) @ service ---
[INFO] Node v10.11.0 is already installed.
[INFO] NPM 6.4.1 is already installed.
[INFO] 
[INFO] --- frontend-maven-plugin:1.9.1:npm (npm install) @ service ---
[INFO] Running 'npm install' in /Users/vbhavana/workspace/service
[INFO] up to date in 4.904s
[INFO] 
[INFO] --- frontend-maven-plugin:1.9.1:webpack (webpack build) @ service ---
[INFO] Running 'webpack.js ' in /Users/vbhavana/workspace/service
[INFO] Hash: 935176e6ab6f3af4130c
[INFO] Version: webpack 4.43.0
[INFO] Time: 1261ms
[INFO] Built at: 06/26/2020 5:53:28 PM
[INFO]                                      Asset     Size  Chunks             Chunk Names
[INFO] ./src/main/resources/static/dist/bundle.js  825 KiB    main  [emitted]  main
[INFO] Entrypoint main = ./src/main/resources/static/dist/bundle.js
[INFO] [./src/main/resources/static/js/index.js] 236 bytes {main} [built] [1 warning]
[INFO]     + 185 hidden modules
[INFO] 
[INFO] WARNING in ./src/main/resources/static/js/index.js
[INFO] Module Warning (from ./node_modules/eslint-loader/dist/cjs.js):
[INFO] Failed to load plugin 'react' declared in '.eslintrc': createRequire is not a function
[INFO] Referenced from: /Users/vbhavana/workspace/service/.eslintrc
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 4 resources
[INFO] 

any additional setup needed for the same?

Thanks for this plugin!

eirslett commented 4 years ago

Make sure you're using the same versions of node.js and npm?

rubystar commented 4 years ago

Hey, nvm. I needed to use node >10.12 as mentioned in the eslint docs. I upgraded node to v10.20 and this issue is resolved. Again, thanks for this plugin. Closing the issue