Giter VIP home page Giter VIP logo

Comments (8)

AdriVanHoudt avatar AdriVanHoudt commented on May 30, 2024

👍 (I want to help but also not a lot of time :/ )

from eslint-config-hapi.

spruce-bruce avatar spruce-bruce commented on May 30, 2024

Added a PR #32 - some notes:

The main changes here are

  1. Update tests to check for new message format (using single instead of double quotes)
  2. no-arrow-condition rule was removed. In order to check for if ((foo) => 1) { you have to use no-constant-condition instead, which also checks for if (true) {, etc
  3. space-after-keywords has been removed. keyword-spacing is used in its place. keyword-spacing is a more far reaching rule and includes spaces before keywords as well. In this PR keyword-spacing is on, but we can configure this rule to require spaces after and disallow spaces before keywords. It doesn't look like this can be configured to require spaces after and not care about spaces before. I'm not sure if this is important.

from eslint-config-hapi.

cjihrig avatar cjihrig commented on May 30, 2024

Closed in bd415cb

from eslint-config-hapi.

prashaantt avatar prashaantt commented on May 30, 2024

I just updated to v9. I know this doesn't properly fit in hapi's domain but I wanted to leave this here, fwiw.

My hapi project uses ES6 modules in the client-side code. With the new space-after-keywords rule, things like

import { Component } from 'react';
import * as actions from './actions';

don't lint for spaces around the from and as. I have had to now override the rule in my project as:

"keyword-spacing": [2, { "after": true }]

which then doesn't care about spaces before keywords. Perhaps it would be good to leave out the "before": false rule from this plugin itself as it could potentially cause similar such issues.

from eslint-config-hapi.

cjihrig avatar cjihrig commented on May 30, 2024

This is a really annoying situation. In older versions of ESLint we used space-after-keywords, but did NOT use space-before-keywords (in accordance with the hapi style guide). Now that we have to use keyword-spacing, my understanding (someone correct me if I'm wrong on all of this) is that the before setting is either true or false, and that there is no option to just ignore. Your proposal of leaving out before: false actually means making it before: true. I would be OK with doing this if we can prove that it doesn't create any new linting errors for code that adheres to the style guide.

from eslint-config-hapi.

cjihrig avatar cjihrig commented on May 30, 2024

OK, I've tested a few hapi modules and having before: true seems fine. I'll take a PR for it.

from eslint-config-hapi.

prashaantt avatar prashaantt commented on May 30, 2024

You're right, rewriting the above rule as follows clarifies the intent:

"keyword-spacing": [2, { "before": true }] // by default, `after` is true, `before` is false

As for whether this won't break existing code, space-before-keywords used to default to always, which to me looks equivalent to the new "before": true. I think we should be fine here.

edit: oops, you beat me to it :) PR on the way.

from eslint-config-hapi.

lock avatar lock commented on May 30, 2024

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

from eslint-config-hapi.

Related Issues (20)

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.