Comments (8)
@santiph At what capacity are you thinking Bard should contain ESLint support? Seeing as you can lint just about anything you want (and also exclude) not sure what you are looking for?
from bardjs.
@mikeerickson For example, If no-undef: "error"
and you inject an application component using Bard, when you use it on your tests, ESLint throws a linting error. This can be avoided by declaring the vars on a global comment at the top of the file, so is no big deal, but it would be great if ESLint recognised the components injected by Bard.
from bardjs.
Ah, this is because it is a global variable. You can also fix as
/*global error*/
Or, in your package.json
"eslintConfig": {
...
"globals": {
"error": true
}
},
from bardjs.
@mikeerickson I have tried what you suggest, and it doesn't seem to change anything. Maybe I did't get my message across, let me show you an example:
/* eslint-env mocha */
/* eslint no-undef:2 */
/* global error */
describe('example', function() {
beforeEach(function() {
bard.appModule('app.module');
bard.inject('exampleService');
});
it('should do something', function() {
exampleService.someMethod();
});
});
'exampleService' is not defined (no-undef)
That's what I mean, does it make sense?
I think it would be very nice if there was a Bard plugin for ESLint so that injected components are recognised as defined. As I said before, the way around it is to declare the injected component as a global /* global exampleService */
but it sort of misses the whole point for using Bard.
from bardjs.
@rglepper So in your case, if you apply
/* eslint no-undef: 0 */
Then it would take care of your issue (no?) I hear what you are saying, but creating a specific bard-eslint-plugin to workaround these types of eslint warnings / errors is sort of out of the scope when specific rules outside of bards control (ie your own choosing) the no-undef switch would do the trick
If I am still missing your point and you feel a bard-eslint-plugin
would make additional sense, please let me know.
from bardjs.
I was expecting a better solution than copy/pasting this on every test file:
/*global bard $controller $httpBackend $q $rootScope */
from bardjs.
You can again apply this in your package.json as follows
"eslintConfig": {
...
"globals": {
"error": true,
"$controller": true,
"$httpBackend": true,
"$rootScope": true
}
},
This way, you don't have to apply to each of your test files.
from bardjs.
@santiph See previous message...
from bardjs.
Related Issues (20)
- Issue testing routes using bardjs
- Failed to instantiate module function fakeRouteProvider
- mockService cannot omit config HOT 2
- Mocking a Data Service
- Mock Data Undefined HOT 1
- Type error 'undefined' evaluating 'bard.appModule....' HOT 2
- How to test Controller with $scope? HOT 11
- ReferenceError: Can't find variable: getinjectargs HOT 1
- Unable to test using PhantomJS HOT 6
- Unit testing with ng-html2js and Bard.js possible
- Mock resolving promise
- add components (angular 1.5 ) option to bardjs HOT 3
- Compile errors with Bard + Typescript + Jasmine HOT 3
- Unable to install - "Not compatible with your operating system or architecture: [email protected]"
- How to test a service with mocked dependencies services HOT 1
- This repo needs a new caretaker
- Publish v0.1.10 to npm
- MockService Doesn't Work with Services Defined as an ES6 Class
- v
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 bardjs.