Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 08:18
    FieryCod commented #1379
  • Jan 30 10:01
    atif089 commented #1379
  • Jan 30 10:01
    atif089 commented #1379
  • Jan 30 10:01
    atif089 commented #1379
  • Jan 30 04:11
    tclindner opened #1998
  • Jan 28 05:21

    ljharb on master

    [eslint config] [base] [patch] … [eslint config] [patch] extend … Merge pull request #1996 from r… (compare)

  • Jan 28 05:21
    ljharb closed #1996
  • Jan 28 04:50
    ljharb synchronize #1996
  • Jan 27 21:45
    ljharb closed #1997
  • Jan 27 21:45

    ljharb on master

    [editorial] [react] fix typo [eslint config] [*] [deps] upda… (compare)

  • Jan 27 21:39
    ljharb synchronize #1997
  • Jan 27 21:39
    ljharb labeled #1997
  • Jan 27 21:39
    ljharb labeled #1997
  • Jan 26 18:14
    ljharb labeled #1996
  • Jan 26 18:14
    ljharb labeled #1996
  • Jan 26 18:13
    ljharb synchronize #1996
  • Jan 26 18:05
    ljharb commented #1996
  • Jan 26 08:55
    telmen opened #1997
  • Jan 24 19:37
    peteclark3 commented #1689
  • Jan 24 17:25
    ljharb commented #747
Jordan Harband
@ljharb
everything should only be included via npm
Subho Karmakar
@isubhokarma
Someone please help me with the eslint-prettier setup for React App.
Sayed Sadat
@Skhoshhal
Hello guys! is there any one to help me ?
Daniel Johns
@ClearedFram3
Anyone know how to export a wrapper express-jwt such as
exports.protect = (req, res, next) => {
  expressJwt({ secret: process.env.JWT_SECRET })
  if (!req.user) return res.status(401).json("Unauthorized")
  return next()
}
If I stick expressJwt(...) directly in as a route middleware it works. But I was trying to add my own error message
Should I just exports.protect = expressJwt({ secret: process.env.JWT_SECRET })?
One problem is that sends a stack trace to the user
Sandeep singh
@13banda
Hnn#%%, nun. AA
Nxdx
maoshuaihui
@maoshuaihui
hello
Good afternoon
sombath16496
@sombath16496
Hello, everyone. I have got the error that "ERROR in [at-loader] ./src/app/auth/login/login.component.ts:82:22
TS2339: Property 'toastr' does not exist on type 'LoginComponent'.", when I build the angular app using ng build --prod with webpack.
please help me.
my webpack.config.js file is:

const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const helpers = require('./helpers');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { AngularCompilerPlugin } = require('@ngtools/webpack');
const { resolve } = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const devMode = process.env.NODE_ENV !== 'production';

module.exports = {

entry: {
    vendor: './src/vendor.ts',
    main: './src/main.ts',
    polyfills: './src/polyfills.ts'
},
resolve: {
    extensions: ['.ts', '.js']
},

module: {
    rules: [{
            test: /\.ts$/,
            loaders: [{
                loader: 'awesome-typescript-loader',
                options: { configFileName: helpers.root('src', 'tsconfig.app.json') }
            }, 'angular2-template-loader']
        },
        {
            test: /\.ts$/,
            use: '@ngtools/webpack'
        },
        {
            test: /\.html$/,
            loader: 'html-loader'
        },
        {
            test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
            loader: 'file-loader?name=assets/[name].[hash].[ext]'
        },
        {
            test: /\.(sa|sc|c)ss$/,
            use: [{
                    loader: MiniCssExtractPlugin.loader,
                    options: {
                        hmr: process.env.NODE_ENV === 'development',
                    },
                },
                'css-loader',
                'postcss-loader',
                'sass-loader',
            ],
            exclude: helpers.root('src'),
        },
        {
            test: /\.(css|scss|sass)$/,
            include: helpers.root('src'),
            loader: 'raw-loader'
        }
    ]
},

plugins: [
    new AngularCompilerPlugin({
        mainPath: resolve('./src/main.ts'),
        sourceMap: true,
        nameLazyFiles: false,
        tsConfigPath: resolve('./src/tsconfig.app.json'),
        skipCodeGeneration: true,
        hostReplacementPaths: {
            [resolve('src/environments/environment.ts')]: resolve('src/environments/environment.prod.ts')
        }
    }),
    new MiniCssExtractPlugin({
        filename: devMode ? '[name].css' : '[name].[hash].css',
        chunkFilename: devMode ? '[id].css' : '[id].[hash].css',
    }),
    new webpack.ContextReplacementPlugin(
        /angular(\\|\/)core(\\|\/)@angular/,
        helpers.root('./src'), {}
    ),
    new HtmlWebpackPlugin({
        template: 'src/index.html'
    }),
    new CopyWebpackPlugin([{
            from: 'src/assets',
            to: 'assets'
        },
        {
            from: 'src/favicon.ico'
        }
    ])
]

};

Jordan Harband
@ljharb
@sombath16496 this is a channel for airbnb's javascript styleguide, not a genericb help channel (airbnb also doesn't use angular)
1point7point4
@1point7point4
hello all could i please have help with js i'm another noob who didn't read the roomdesc
Nishant
@nishantrpai
I'm writing an article on how to organize react code, was researching on how airbnb organizes theirs? Do you guys go for flat-file structure like Facebook or nested?
If nested on what basis do you make that heirarchy
Jordan Harband
@ljharb
definitely nested. typically by feature
Kushagra Varade
@varadekd

Can someone please help me

To detect wether the user has clicked on confirm or on leave page for beforeunload event in js

Richard Sithole
@Sliqric7053

Hi there

I have a 10x4 grid of checkboxes (call it x, y) in an html form - I would like to get the coordinates (x, y values) of the checkbox when a user selects one. What data structure can I use to pluck out those coordinates?

I've tried using a Map like so:

 onCheck(e) {
    const productMap = new Map();

    productMap.set('productId', e.path[2].id.split('-').pop());
    productMap.set('productLevelId', e.path[2].id.split('-').pop());
}

The checkboxes are generated dynamically, so I use a click event listener and pass in the clicked element..

The backend expects from me, a payload like this:

{
productId: 4,
productLevelId: 1
}

The above coordinates represent a checked checkbox within the grid.

Any ideas how I can accomplish this?

Igor Gassmann
@IGassmann

Hey guys! That's probably a basic question, but how do you deal with objects retrieved from dependencies that have named their properties with names that aren't in accordance with Airbnb Style Guide? Here's an example:

const insertResult = await mongodb.collection.insertOne(document);
const newDocumentId = insertResult.ops[0]._id;

Here ESLint will throw the no-underscore-dangle error for the _id.

Jordan Harband
@ljharb
@IGassmann you use an eslint override comment
Igor Gassmann
@IGassmann
@ljharb thanks!
jomarquez
@jomarquez
Hello, i am trying to set up my vs code with the Airbnb JavaScript Style Guide. I have the ESLint 1.9.1 extension enabled but it seems to be reading 2 .eslintrc rules?
I'll see a warning: Extra Semicolon and if i remove it, a Missing Semicolon error.
i did run into the following documentation: https://travishorn.com/setting-up-eslint-on-vs-code-with-airbnb-javascript-style-guide-6eb78a535ba6 but they are not using eslint-config-airbnb package, instead, the example uses eslint-config-airbnb-base
Jordan Harband
@ljharb
@jomarquez not familiar with that extension, but that error text doesn't come from eslint
Javier Pons
@JavierPons
How I can do if(string.Object . is equal to "this text") then something.
Jordan Harband
@ljharb
@javierpons I’m not sure what you’re asking
Javier Pons
@JavierPons
@ljharb dont worry, Its solve. Thnx anyway
Jordan Harband
@ljharb
np
Subho Karmakar
@isubhokarma
How do we declare multiple values to the same variable? like - const baseUrl = "http://host:8082/user/phone" and "http://host:8082/user/email" for my User Search Bar
Please help!!!!
Jordan Harband
@ljharb
@isubhokarma that's not possible. you can have an array or an object that holds two values, but that's still a single value in a variable. i'm not aware of any programming language where that's possible.
also, this isn't a general help channel, it's specifically to discuss airbnb's javascript styleguide
SPBST
@SPBST
Hi, I’m new to JavaScript web development. Could you please tell me steps and require softwares to run Airbnb JavaScript for Windod
*windows machine
Jordan Harband
@ljharb
you need node, is all.
Louis Law
@louiscklaw

Hi everyone,
I would like to know meaning of three dots expression in front of this line
[...Array(5).keys()];

where can i find the information about this ? or any keywords/hints for me such that i can search google this ?

thanks in advance
Jordan Harband
@ljharb
@louiscklaw it’s spread syntax (altho in this case it’s bad, don’t use Array() ever)
this one should be Array.from({ length: 5 }, (, i) => i)
you can google it or read on mdn.
SPBST
@SPBST
@ljharb I will try with Node, Thanks!
Louis Law
@louiscklaw
@ijharb many thanks
@ijharb i got it on MDN, thank you so much
Muhammad
@MuhammadJamaluddin
I am having weird Parsing error: Unexpected token / & Parsing error: Unexpected token =eslint errors in my components... why is that?