Skip to content
This repository was archived by the owner on Sep 28, 2020. It is now read-only.

Webpack is showing wrong eslint linting errors on console #222

Closed
noumanaltaf opened this issue Mar 14, 2018 · 9 comments
Closed

Webpack is showing wrong eslint linting errors on console #222

noumanaltaf opened this issue Mar 14, 2018 · 9 comments

Comments

@noumanaltaf
Copy link

noumanaltaf commented Mar 14, 2018

When I start my dev server webpack console some linting errors that don't exist actually. You can see code given below error is saying "Strings must use singlequote" but actually in code there is no single quotation used.
"eslint-loader": "1.9.0"
"webpack": "1.14.0"

webpack.config.js

 module: {
    loaders: [
      /* eslint-disable */
      {
        enforce: 'pre',
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'eslint-loader',
        options: {
          fix: true,
          quiet: true,
        },
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        options: {
          fix: true,
          quiet: true,
        },
      },
]
}

controller.js

const columnSelectorCtrl = ($scope, $rootScope, $modal, columnSelectionApi) => {
      const openSelectionPopup = () => {
        const saveSelectionHandler = () => {
          if ($scope.isColumnSelectionToBeSaved) {
            const selectionPayload = {
              pageId: $scope.pageId,
              selectedColumnIds: _.pluck(
                _.filter($scope.columnsList, (column) => column.show), ['id']
              ),
            };

            columnSelectionApi.save(selectionPayload);
          }
        };
        $scope.columnSelectPopup = $modal.open({
          templateUrl: 'columnSelectTemplate.html',
          controller: columnSelectorCtrl,
          scope: $scope,
        });

        return $scope.columnSelectPopup.result.finally(saveSelectionHandler);
      };

      const isColumnShown = (column) => column.show;
      const isAnyColumnShown = (columnsList) => columnsList.some(isColumnShown);
      const mapShownStateWithDefault = (column) =>
        (column.show = column.show_by_default);
      const showDefaultColumnSelection = (columnsList) =>
        columnsList.forEach(mapShownStateWithDefault);

      const determineToShowDefaultSelection = (columnsList) => {
        $scope.$watch(
          'columnsList',
          function(newList, oldList) {
            console.log('config changed');
            if (newList && !isAnyColumnShown(newList)) {
              showDefaultColumnSelection(newList);
            }
          },
          true
        );
      };

      $scope.closeSelectionPopup = () => $scope.columnSelectPopup.close();

      (function initialize() {
        $scope.openColumnsPopup = openSelectionPopup;
        determineToShowDefaultSelection($scope.columnsList);
      })();
    };

    export {
      columnSelectorCtrl,
    };

lint error

@ooflorent
Copy link

Could you try using a newer version of webpack? Please also delete node_modules/.cache directory.

@crashuniverse
Copy link

@noumanaltaf Did upgrading to a new webpack version help?

@sachinjain526
Copy link

I'm facing the same issue with webpack versions 4.16.0 and 4.16.2.

@ydegtyar
Copy link

Have the same issue, are you beat it?

@totodot
Copy link

totodot commented Sep 24, 2018

Have you found any solution to this problem?

@ydegtyar
Copy link

Have you found any solution to this problem?

Just try to remake your bundling step by step

@totodot
Copy link

totodot commented Sep 24, 2018

Do you have any suggestions that would help solve this problem? Can you add the version of the libraries you use?

@kyllle
Copy link

kyllle commented Sep 27, 2018

Hi, I'm experiencing the same issue:

"webpack": "^4.17.1"
"babel-core": "^6.26.3"
"babel-eslint": "^7.2.3"
"eslint": "^4.9.0"
"eslint-loader": "^2.0.0"

Webpack rule:

{
  test: /\.js$/,
  exclude: /node_modules\/(mock-data)/,
  enforce: 'pre',
  use: [
    {
      loader: 'babel-loader',
      options: {
        cacheDirectory: true,
        compact: true,
        presets: [
          [ 'es2015', { modules: false } ]
        ]
      }
    },
    {
      loader: 'eslint-loader',
      options: {
        quiet: true
      }
    }
  ]
}

screen shot 2018-09-27 at 11 50 40 am

I removed node_modules/.cache but still see these errors that simply don't exist :/

@elchinillo
Copy link

Hi, having the same issue here. When I first start webpac-dev-server I got a successful build, once a new build finishes I get non sense errors

"webpack": "^2.3.3",
"webpack-dev-server": "^2.11.3",
"eslint": "^5.13.0",
"eslint-loader": "^2.1.2",
"@babel/core": "^7.3.3",

MyComponent.jsx: Unexpected token, expected "{" (3:7)

  1 | // @flow
  2 | import { PrimaryButton } from 'ui-lib/Button';
> 3 | import Modal from 'react-bootstrap/lib/Modal';

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants