hapijs / eslint-config-hapi Goto Github PK
View Code? Open in Web Editor NEWShareable ESLint config for the hapi ecosystem
License: Other
Shareable ESLint config for the hapi ecosystem
License: Other
Enforce rule for variables named e
, err
, and error
. Per outmoded/hapi-contrib#65.
'handle-callback-err': [2, '^(e|err|error)$']
🚨 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.
http://eslint.org/docs/user-guide/migrating-to-2.0.0
I wouldn't mind submitting a PR, but I won't have time for a couple days probably.
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)
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.
As of [email protected], arrow functions are also checked. This requires an update of eslint-plugin-hapi as well.
This rule was enabled in v6.0.0, but disabled in v6.1.0 (9390aca). See commit message for reason rule was disabled. Either need a change in the ESLint rule, or a custom rule.
warning "[email protected]" has unmet peer dependency "[email protected]".
$ yarn add jest -D jest eslint eslint-config-hapi eslint-plugin-hapi
yarn add v0.21.3
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "[email protected]" has unmet peer dependency "[email protected]".
[4/4] Building fresh packages...
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.
This rule is currently under development in ESLint (eslint/eslint#4144).
Would love eslint 5 support!
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.
Require { a }
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
};
Add https://eslint.org/docs/rules/key-spacing rule
Would gladly PR
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
.
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
Allow a single variable per const/let/var (although var is prohibited by other rules).
Any thoughts on the new rules from 2.9?
Both seems fine to enable?
Space only after function
keyword, not before name.
var a = function () {};
var b = function name() {};
function c() {};
The rules added with 1.8 seem useful to add
also no-shadow
now has an allow
option see http://eslint.org/docs/rules/no-shadow#allow which can replace https://www.npmjs.com/package/no-shadow-relaxed if I am correct
il
style variables, and comparing directly against length.i
, j
, and k
. Hopefully nesting doesn't go beyond 3 deep.#8 removed a duplicated rule in the config. We should have a test that loops over the keys in the config to make sure there are no duplicates.
The readme mentions "require ES6 features" ... which ones?
A few rules used in this config are deprecated in http://eslint.org/blog/2016/08/eslint-v3.3.0-released.
See eslint/eslint#6820.
See outmoded/hapi-contrib#58 (comment)
(foo) => ({ bar: foo })
) including line breaks in the {}
(nothing needed, the language takes care of this)() => () => 42
) (need a rule for this)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.
This replaces #18 (validate hapi-scope-start for arrow functions). [email protected] milestone is tracked here.
Could you, please, explain on https://hapijs.com/styleguide why 'comma-dangle': ['error', 'never']
?
Why not always?
Thank you.
I recently added "brace-style": [2, "stroustrup"]
to my setup but if I am correct this is also the hapi style no?
Currently at 100% code coverage, but ideally there would be a test for each rule that is enabled.
This includes dropping the ES5 only config.
If I create a funtion on a non declared variable, I don't get an error.
Is it possible to add for that?
I'm wondering why hapi-capitalize-modules
isn't strictly enforced, even though the Hapi style guide isn't ambivalent on this rule.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.