EmmanuelDemey / eslint-plugin-angular

ESLint plugin for AngularJS applications
https://www.npmjs.com/package/eslint-plugin-angular
618 stars 131 forks source link

Error after upgrade to 1.6.2 #450

Open prashantpalikhe opened 7 years ago

prashantpalikhe commented 7 years ago

Warning: Error while loading rule 'angular/angularelement': ruleCreator is not a function

Seems like plugin is loaded after the rule is attempted to be retrieved.

elamperti commented 7 years ago

Same here, different error through a Grunt linting task: Warning: Cannot read property 'replace' of undefined Use --force to continue.

EmmanuelDemey commented 7 years ago

I have just executed the unit test for this rule, and do not have any errors. I will ublish a the 1.6.3 release this afternoon with a fix for #454 . Can you test again with this new version ?

EmmanuelDemey commented 7 years ago

I have just executed the unit test for this rule, and do not have any errors. I will ublish a the 1.6.3 release this afternoon with a fix for #454 . Can you test again with this new version ?

elamperti commented 7 years ago

@Gillespie59 sorry for the delay, I'll ask someone in my team to test it and we'll update here. Thanks for your work :smiley:

svandriel commented 7 years ago

This has been fixed in the current eslint version. It now supports for both rules with a create function and rules that are a function by itself.

See https://github.com/eslint/eslint/blob/master/lib/eslint.js#L867

crash7 commented 7 years ago

Hello, I work with @elamperti, we have tested version 1.6.3 and seems that it solved the issue, the eslint version we are using is the 3.17.0. Thanks!

EmmanuelDemey commented 7 years ago

So I can close this issue?

EmmanuelDemey commented 7 years ago

I close the issue. You can reopen it at any time

IgorKurkov commented 5 years ago

I have the same issue. package.json:

  "dependencies": {
    "@angular/router": "^0.2.0",
    "angular": "^1.5.3",
    "angular-animate": "^1.4.8",
    "angular-cookies": "^1.5.0",
    "angular-google-places-autocomplete": "^0.2.9",
    "angular-immutable": "^0.1.3",
    "angular-marked": "^1.2.0",
    "angular-payments": "^1.0.7",
    "angular-scroll": "^1.0.0",
    "angular-ui-carousel": "^0.1.10",
    "angular-xeditable": "^0.8.1",
    "angularjs-slider": "^4.0.2",
    "angularjs-social-login": "^2.6.1",
    "axios": "^0.19.0",
    "checklist-model": "^0.11.0",
    "eslint-config-angular": "^0.5.0",
    "eslint-plugin-angular": "^4.0.1",
    "foundation-apps": "^1.2.0",
    "immutable": "^3.8.2",
    "js-data": "^2.8.2",
    "js-data-angular": "^3.1.0",
    "lodash": "^4.17.11",
    "ng-file-upload": "^12.0.4",
    "object-assign": "^4.1.0",
    "raven-js": "^3.20.1",
    "rxjs": "^5.5.2",
    "scrollreveal": "^3.4.0",
    "stripe": "^4.5.0",
    "tether": "^1.4.2",
    "url-loader": "^0.6.2",
    "uuid-js": "^0.7.5"
  },
  "devDependencies": {
    "autoprefixer": "^6.3.4",
    "babel-core": "^6.26.3",
    "babel-eslint": "^4.1.6",
    "babel-loader": "7.1.2",
    "babel-plugin-angularjs-annotate": "0.8.2",
    "babel-preset-es2015": "^6.3.13",
    "css-loader": "0.28.7",
    "eslint": "^1.10.3",
    "eslint-loader": "^1.2.0",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "^0.11.2",
    "git-revision-webpack-plugin": "2.5.1",
    "html-loader": "0.5.1",
    "html-webpack-plugin": "2.30.1",
    "image-webpack-loader": "3.4.2",
    "jasmine-core": "^2.3.4",
    "karma": "^0.12.37",
    "karma-babel-preprocessor": "^5.2.2",
    "karma-chrome-launcher": "^0.1.12",
    "karma-firefox-launcher": "^0.1.4",
    "karma-jasmine": "^0.3.6",
    "karma-ng-html2js-preprocessor": "^0.1.2",
    "ngtemplate-loader": "2.0.1",
    "node-sass": "^4.12.0",
    "postcss-loader": "2.0.9",
    "prettier": "^1.18.2",
    "sass-loader": "6.0.6",
    "style-loader": "^0.13.0",
    "uglifyjs-webpack-plugin": "1.1.4",
    "webpack": "3.10.0",
    "webpack-dev-server": "2.9.7",
    "webpack-notifier": "1.5.0"
  }

if I try add 'angular' to .eslintrc extends array

"extends": ["eslint:recommended", "angular"],

there are error

ERROR in ./src/bootstrap.js
Module build failed: TypeError: Error while loading rule 'angular/angularelement': ruleCreator is not a function
    at C:\Projects\project\node_modules\eslint\lib\eslint.js:692:28
    at Array.forEach (<anonymous>)
    at EventEmitter.module.exports.api.verify (C:\Projects\project\node_modules\eslint\lib\eslint.js:671:16)
    at processText (C:\Projects\project\node_modules\eslint\lib\cli-engine.js:230:27)
    at CLIEngine.executeOnText (C:\Projects\project\node_modules\eslint\lib\cli-engine.js:686:26)
    at lint (C:\Projects\project\node_modules\eslint-loader\index.js:218:17)
    at Object.module.exports (C:\Projects\project\node_modules\eslint-loader\index.js:213:21)
 @ multi (webpack)-dev-server/client?http://localhost:9000 webpack/hot/dev-server bootstrap.js
IgorKurkov commented 5 years ago

generally, through these 20 days, I didn't find a solution, also it was an old repo on angular 1.5, so it's not so important already, but if it will be possible to fix this error - it helps work with old repos in future and update them or rewrite ... never mind. I resurrected two abandoned npm packages at least to start it with updated dependencies :) so ...