Giter VIP home page Giter VIP logo

eslint-config-hapi's People

Contributors

adrivanhoudt avatar aorinevo avatar cjihrig avatar devinstewart avatar diegorbaquero avatar hueniverse avatar iantocristian avatar jarrodyellets avatar kanongil avatar lerouxb avatar nargonath avatar nlf avatar prashaantt avatar sfabriece avatar spruce-bruce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eslint-config-hapi's Issues

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Configuration for rule "indent" is invalid

Benjamins-MacBook-Pro:bell ben$ npm install -g eslint-config-hapi eslint-plugin-hapi
[email protected] /usr/local/lib/node_modules/eslint-config-hapi

[email protected] /usr/local/lib/node_modules/eslint-plugin-hapi
├── [email protected]
├── [email protected]
└── [email protected] ([email protected])
Benjamins-MacBook-Pro:bell ben$ eslint .
/usr/local/lib/node_modules/eslint/lib/config.js:129
                    throw e;
                          ^
Error: eslint-config-hapi:
    Configuration for rule "indent" is invalid:
    Value "data["2"].SwitchCase" has additional properties.

Referenced from: /Users/ben/projects/bell/node_modules/lab/lib/linters/eslint/.eslintrc
Referenced from: /Users/ben/projects/bell/.eslintrc
    at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config-validator.js:88:15)
    at /usr/local/lib/node_modules/eslint/lib/config-validator.js:101:13
    at Array.forEach (native)
    at Object.validate (/usr/local/lib/node_modules/eslint/lib/config-validator.js:100:35)
    at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:99:19)
    at /usr/local/lib/node_modules/eslint/lib/config.js:123:46
    at Array.reduceRight (native)
    at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:111:36)
    at /usr/local/lib/node_modules/eslint/lib/config.js:123:46
    at Array.reduceRight (native)

validation aware eslint-config

I was wondering if it is remotely possible to make eslint validation aware.
Meaning that If I create a Joi validation for a route, then in the handler, I try accessing a property on the request object that is not in the validation. I would get an error.

Even better, to make eslint aware of all hapi properties.

Update eqeqeq rule

I'd like to propose adding "allow-null" to the eqeqeq rule. This would allow for checks for values of null or undefined to be done like:

function (value) {
  if (value == null) {
    console.log('value is null or undefined');
  }

While it's generally not a great idea to let JS do whatever it wants during coercion, in this one instance, I think the trade off is worth it as checking == null is a pretty common and understood pattern.

unused-variable improvement

Would be nice if the unused variables weren't checked for as part of function arguments, i.e.

Wreck.get('https://google.com/', function (err, res, payload) {
    /* do stuff */
});

Here I will use err and payload, but the res which I have no choice but to add since the function signature shows up this way, will still be reported. This is annoying if I can't do anything about it.

Function signatures should be ignored because you'll want to show what was passed.

Rule request: key-spacing

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: 12
  • module version: latest
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): hapi
  • any other relevant information:

What problem are you trying to solve?

I believe https://eslint.org/docs/rules/key-spacing should be added, this should at least warn:

const object = {
    myKey1:'hello'
    myKey2:        123
};

Hopefully to be consistent with spaces and strict mode:

const object = {
    myKey1: 'hello'
    myKey2: 123
};

Do you have a new or modified API suggestion to solve the problem?

Add https://eslint.org/docs/rules/key-spacing rule

Would gladly PR

Add an ES5 compatible config?

We love your custom config, but many of our projects still use ES5, so we have to extend the eslint-config-hapi config and then disable ES6-specific rules (specifically prefer-arrow-callback and no-var -- although we'd have to adjust in the future if new ES6 rules were added to your config).

Not sure if you want to add another shared config which extends your base config (lib/index.js) and overrides/disables ES6 specific rules. That way we could simply do extends: hapi/es5.

Incorrect bug - sorry

So I copied across to my client eslint config which uses eslint 2.xx

I had to make these changes:

    "keyword-spacing": [2, { "before": true, "after": true, "overrides": {}}],
    "no-shadow": [2, { "builtinGlobals": false, "hoist": "functions", "allow": [] }],

and deleted the duplicate

"no-cond-assign": 2,

I had to comment out the brace style cutom rule as not sure how to use it locally

Enable rule one-var

Allow a single variable per const/let/var (although var is prohibited by other rules).

`for` loop enhancements

  • Look into enforcing dropping il style variables, and comparing directly against length.
  • Enforce iterator variable names of i, j, and k. Hopefully nesting doesn't go beyond 3 deep.

Arrow function custom rules

See outmoded/hapi-contrib#58 (comment)

  • enforce arguments parentheses (done)
  • parentheses around object creation allowed ((foo) => ({ bar: foo })) including line breaks in the {} (nothing needed, the language takes care of this)
  • no function creation with implicit return (() => () => 42) (need a rule for this)
  • allow single statements on single line to use implicit return without {} (update to [email protected])

UPDATE: Just need a new rule for no function creation with implicit return.
UPDATE: no-arrowception rule created to detect implicitly created arrow functions.

Brace style

I recently added "brace-style": [2, "stroustrup"] to my setup but if I am correct this is also the hapi style no?

Create more tests

Currently at 100% code coverage, but ideally there would be a test for each rule that is enabled.

Catch undeclared variables

If I create a funtion on a non declared variable, I don't get an error.
Is it possible to add for that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.