ljharb

ljharb

software engineer/nerd/teacher/will try anything once; surgeon with git rebase. @tc39, ex @airbnb @twitter @MobBase @tripit. Fav punctuation ⸮, scent petrichor

Member Since 13 years ago

Hillsborough, CA

Experience Points
4.8k
follower
Lessons Completed
267
follow
Lessons Completed
521
stars
Best Reply Awards
200
repos

6240 contributions in the last year

Pinned
⚡ JavaScript Style Guide
⚡ Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
⚡ ECMAScript 5 compatibility shims for legacy (and modern) JavaScript engines
⚡ A querystring parser with nesting support
⚡ Tracking ECMAScript Proposals
Activity
Jan
22
18 hours ago
Activity icon
created tag

ljharb in browserify/resolve create tag v1.22.0

createdAt 1 hour ago
push

ljharb push ljharb/resolve

ljharb
ljharb

[New] add default support for paths to include $HOME/.node_{modules,libraries} (#273)

Note, this is a rarely used feature that should be aggressively avoided, but it‘s important to minimize gaps between node and this package.

Fixes #163

commit sha: 9bd06c01fe8051e5940b70bed3e2ad4b86691398

push time in 1 hour ago
push

ljharb push browserify/resolve

ljharb
ljharb

[New] add default support for paths to include $HOME/.node_{modules,libraries} (#273)

Note, this is a rarely used feature that should be aggressively avoided, but it‘s important to minimize gaps between node and this package.

Fixes #163

commit sha: 9bd06c01fe8051e5940b70bed3e2ad4b86691398

push time in 1 hour ago
Activity icon
delete

ljharb in browserify/resolve delete branch home-paths

deleted time in 1 hour ago
pull request

ljharb pull request browserify/resolve

ljharb
ljharb

[New] add default support for `paths` to include `$HOME/.node_{modules,libraries}`

Note, this is a rarely used feature that should be aggressively avoided, but it‘s important to minimize gaps between node and this package.

Fixes #163.

I'm uncertain if I'll backport this to the 1.x branch, primarily because of the risk of unintentional breakage. However, since virtually nobody is going to be using these directories, and since it's only going to potentially start resolving bare specifiers where previously there was an error, this does seem safe.

push

ljharb push browserify/resolve

ljharb
ljharb

[New] add default support for paths to include $HOME/.node_{modules,libraries}

Note, this is a rarely used feature that should be aggressively avoided, but it‘s important to minimize gaps between node and this package.

Fixes #163

commit sha: 66066fd4d645041c4e892130b991c5ed1f80e57a

push time in 1 hour ago
Activity icon
issue

ljharb issue browserify/resolve

ljharb
ljharb

doesn't support `$HOME/.node_modules` or `$HOME/.node_libraries`

Hi, thanks for this module! It seems to have trouble finding my packages, though:

$ readlink -m ~/.node_modules
/mnt/…/nodejs/modules
$ nodejs -e 'console.log(require.resolve("lodash")); require("resolve")("lodash", console.log);'
/mnt/…/nodejs/modules/lodash/lodash.js
{ Error: Cannot find module 'lodash' from '.'
    at /mnt/…/nodejs/modules/resolve/lib/async.js:50:31
    at processDirs (/mnt/…/nodejs/modules/resolve/lib/async.js:184:39)
    at ondir (/mnt/…/nodejs/modules/resolve/lib/async.js:199:13)
    at load (/mnt/…/nodejs/modules/resolve/lib/async.js:82:43)
    at onex (/mnt/…/nodejs/modules/resolve/lib/async.js:107:17)
    at /mnt/…/nodejs/modules/resolve/lib/async.js:12:69
    at FSReqWrap.oncomplete (fs.js:152:21) code: 'MODULE_NOT_FOUND' }

So require.resolve was able to find it, but resolve wasn't. However, it works when I create a symlink /mnt/…/nodejs/node_modules to modules.

Update: Work-around: It also works when I pass option { paths: [process.env.HOME + "/.node_modules"] } Update 2: However, in that case I have to then explicitly resolve the returned path in order to get the exact same result.

Activity icon
issue

ljharb issue comment import-js/eslint-plugin-import

ljharb
ljharb
ljharb
ljharb

The "native" windows tests still seem to be failing.

push

ljharb push react-dates/react-dates

ljharb
ljharb

[Dev Deps] update @babel/cli, @babel/core, @babel/register, @babel/runtime

ljharb
ljharb

[Dev Deps] use @babel/eslint-parser instead of babel-eslint

ljharb
ljharb

[Dev Deps] update eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-react-with-styles

commit sha: 0772b778b4506947c17ecdd438b0bec78a9d32ba

push time in 1 hour ago
push

ljharb push react-dates/react-dates

ljharb
ljharb

[Dev Deps] update @babel/cli, @babel/core, @babel/register, @babel/runtime

ljharb
ljharb

[Dev Deps] use @babel/eslint-parser instead of babel-eslint

ljharb
ljharb

[Dev Deps] update eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-react-with-styles

commit sha: 0772b778b4506947c17ecdd438b0bec78a9d32ba

push time in 1 hour ago
push

ljharb push react-dates/react-dates

ljharb
ljharb

[Dev Deps] update @babel/cli, @babel/core, @babel/register, @babel/runtime

ljharb
ljharb

[Dev Deps] use @babel/eslint-parser instead of babel-eslint

ljharb
ljharb

[Dev Deps] update eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-react-with-styles

commit sha: 0b35dd572b547b5612dbfd423a2e683a9b412afb

push time in 1 hour ago
push

ljharb push react-dates/react-dates

ljharb
ljharb

[Dev Deps] update @babel/cli, @babel/core, @babel/register, @babel/runtime

ljharb
ljharb

[Dev Deps] use @babel/eslint-parser instead of babel-eslint

ljharb
ljharb

[Dev Deps] update eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-react-with-styles

commit sha: 0b35dd572b547b5612dbfd423a2e683a9b412afb

push time in 1 hour ago
pull request

ljharb merge to import-js/eslint-plugin-import

ljharb
ljharb

[Tests] `no-nodejs-modules`: add tests for node protocol URL

Just add tests

ljharb
ljharb

Thanks, this is great!

push

ljharb push sosukesuzuki/eslint-plugin-import

ljharb
ljharb

[Tests] no-nodejs-modules: add tests for node protocol URL

commit sha: 1cb0dc735f8a6eab77d1b9f29cde2439cc0c5e31

push time in 1 hour ago
Activity icon
issue

ljharb issue comment nodejs/node

ljharb
ljharb

Iterator helpers throw the error too late

Currently iterator helpers throw type errors on first iteration - they should likely do so synchronously.

For example:

Readable.from([1]).map(1); // returns a stream, for...awaiting it will throw the error

Instead I think we should throw synchronously, which is what I believe the spec says.

A fix would be to take the code in operators.js that does validations that is in an async generator and wrap it so that it does those validations in a function called before the async generator.

So instead of:

async function* map(...) {
  validateFoo(...);
}

We'd do:

function map(...) { // not async to throw synchronously
  validateFoo(...);
  return async function*() {

  }();
}

The test at test-stream-map would similarly need to be updated from rejecting asynchronously on iteration to throwing synchronously. I've opened an issue in the iterator helper proposal to be sure.

That's my understanding here: https://tc39.es/proposal-iterator-helpers/#sec-asynciteratorprototype.map

ljharb
ljharb

Is the intention for stream methods to match the iterator helpers interface?

Activity icon
issue

ljharb issue comment tc39/proposal-iterator-helpers

ljharb
ljharb

Error handling questions

Hey a few questions to make sure:

  • if an error happens when a .map(fn) throws, the error propagates to the consumer, right? (i.e. .next returns a rejected promise and the iterator is closed).
  • if an error happens in an argument, does it happen immediately or when starting the iterator? (that is: does .map(1) throw synchronously or when the generator is first used?)
ljharb
ljharb

Awesome, then they should throw on bad arguments too :-)

Activity icon
issue

ljharb issue comment tc39/proposal-iterator-helpers

ljharb
ljharb

Error handling questions

Hey a few questions to make sure:

  • if an error happens when a .map(fn) throws, the error propagates to the consumer, right? (i.e. .next returns a rejected promise and the iterator is closed).
  • if an error happens in an argument, does it happen immediately or when starting the iterator? (that is: does .map(1) throw synchronously or when the generator is first used?)
ljharb
ljharb

That sounds right for sync methods; but I’d expect the async methods to never throw synchronously.

Activity icon
issue

ljharb issue comment tc39/proposal-observable

ljharb
ljharb

Retain core API and leave operators to user-land libraries

Motivation

The motivation behind this proposal is the need for JavaScript to have a formal interface describing streamable types. You can see this in the way Observable-like implementations are re-implemented time and time again.

  • Redux
  • Mobx
  • Ace Editor
  • Socket.io
  • Express.js

While the browser has the EventTarget interface, allowing objects to implement the addEventListener method - this interface is lacking on Node and further, requires consumers to specify the event name and submit messages through initializing an Event. Great for HTMLElement instances that have several event types (such as click, hover), but less logical for basic streamable data.

The Observable specification, much like Promise, provides a standardised interface that everyone can target.

It's my belief that operators should be dropped from the specification as they can be implemented by user-land libraries and seem to serve to distract from the core value of the proposal.

Lastly, with so many competing implementations, it's much harder to pipe data from one stream into another without hand written adapters bridging the separate stream implementations.

The Whole Thing

Base Type

Implementation via Github gist Example implementation in replit

type Callback<T extends Array<any> = [], U = void> = (...args: T) => U

class Observable<T> {
  constructor(
    setup: Callback<[
      Callback<[T]>,   // Value
      Callback<[any]>, // Error
      Callback,        // Complete
    ], void | Callback<[], any>>
  )

  subscribe(
    value: Callback<[T], any>,
    error?: Callback<[unknown], any>,
    complete?: Callback<[], any>
  ): Subscription
}

class Subscription {
  unsubscribe(): void
}

Usage

const values = new Observable((next, _error, complete) => {
  next('foo')
  setTimeout(complete, 1000)
})

const subscription = values.subscribe(
  console.log, // "foo"
  console.error,
  console.warn, // Will run with empty message
)

Async

Observable will execute synchronously unless an asynchronous action happens in the execution chain somewhere. Such as a fetch in the Observable constructor or a setTimeout in the Subscriber

Errors

If something throws inside an Observable setup callback, an error is pushed to subscribers. If the error method is called, an error is pushed to subscribers.

const values = new Observable(() => {
  throw new Error('Foobar')
})

const subscription = values.subscribe(
  console.log, 
  console.error, // typeof Error message "Foobar"
)

Interfaces

type Callback<T extends Array<any> = [], U = void> = (...args: T) => U

interface Subscriber<T> {
  subscribe(
    value: Callback<[T], any>,
    error?: Callback<[unknown], any>,
    complete?: Callback<[], any>
  ): Unsubscriber
}

interface Unsubscriber {
  unsubscribe(): void
}

What about Subject, ReplaySubject, etc?

These are fantastic types that help with the control flow of streamable values, but can all be made from the base Observable. class. and should therefore be left to user-land libraries to implement

class Subject extends Observable {
  // ...
}

Operators

The use of operators on the Observable type reminds me a bit of how libraries like Bluebird had operators on Promise. Operators being a part of rxjs and rxjs being so popular makes them feel like they are required for Observable to be useful but it's important to recognise that Observable is simple a standard interface to enable the consumption of streamed values. The reactive extensions are there to enhance that behaviour.

While operators may be ergonomic, they are not necessary for the handling of streamable data and can be implemented by user libraries

An example of how operators could be used as implemented by a user-land library is as follows:

const values = new Observable(next => {setInterval(next, 1000, 1)})

const modifiedValues = pipe(values)(
  filter(value => value > 0),
  map(value => value.toString()),
)

modifiedValues.subscribe(console.log)

Conversion to Promise

Much like the challenges described by the rxjs team on what it even means to convert a stream to a Promise, this falls into the domain of user-land libraries.

const values = new Observable(next => {setInterval(next, 1000, 1)})

firstValueFrom(values).then(console.log)
const values = new Observable((_next, _error, complete) => {setTimeout(complete, 1000, 1)})

lastValueFrom(values).then(console.log)

Conclusion

Keeping the API limited in scope allows solving the major issue with streams in JavaScript, a consistent target API.

Activity icon
issue

ljharb issue comment brigand/jellobot

ljharb
ljharb

build(deps): bump node-fetch from 2.6.1 to 3.1.1

Bumps node-fetch from 2.6.1 to 3.1.1.

Release notes

Sourced from node-fetch's releases.

v3.1.1

Security patch release

Recommended to upgrade, to not leak sensitive cookie and authentication header information to 3th party host while a redirect occurred

What's Changed

New Contributors

Full Changelog: https://github.com/node-fetch/node-fetch/compare/v3.1.0...v3.1.1

v3.1.0

What's Changed

... (truncated)

Changelog

Sourced from node-fetch's changelog.

Changelog

All notable changes will be recorded here.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

What's Changed

New Contributors

Full Changelog: https://github.com/node-fetch/node-fetch/compare/v3.1.0...v3.1.2

3.1.0

What's Changed

... (truncated)

Commits
Maintainer changes

This version was pushed to npm by endless, a new releaser for node-fetch since your current version.


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the Security Alerts page.

ljharb
ljharb

Nope, v3 is ESM-only, so we can never upgrade to it.

Activity icon
issue

ljharb issue comment tc39/ecma262

ljharb
ljharb

DataView byteLength/byteOffset still specified to throw when buffer detached

ArrayBuffer & TypedArray accessors were adjusted to no longer throw when the buffer is detached. If I understand right this was motivated by several factors, one of which was existing inconsistency between implementations, some of which already didn’t throw.

The stop-throwing changes didn’t include DataView. It’s still specified with the “old” behavior in its byteLength/byteOffset getters. At the time @rwaldron had commented:

While reviewing & writing tests for this, I noticed that DataView.prototype.byteLength is not included in the changes, but is currently spec'ed to throw on detached array buffers. Implementations currently do not agree.

(I’m not sure what the current situation is for behavior between implementations.)

Could be factors in play that I don’t know about, but it seems a lot like DataView should have gone along for the ride when the others changed. Consider code like if (ArrayBuffer.isView(x)) return x.byteLength — that’s a pretty well-hidden edge case baked in there, the sort that could sit around for a very long time without being noticed since the conditions for tripping the surprise-throw are very narrow. The API surface seems to encourage the assumption that this should behave consistently for all views.

(Also, though this is probably very subjective, from my POV getters that throw are kind of a “surprise” to begin with. Like, unless it’s a super deliberate/unilateral thing like with caller, where it’s saying “don’t do this (at all).” For properties that are actually meant to be used which normally just return numbers, it seems like a weirdly hostile pattern.)

Originally posted by @bathos in https://github.com/tc39/ecma262/issues/678#issuecomment-1018214972

ljharb
ljharb

Almost every getter in the language throws when the receiver lacks the right internal slots.

Activity icon
issue

ljharb issue comment tc39/proposal-deep-path-properties-for-record

ljharb
ljharb

Support for transforming updates?

Should nested updates like #{...rec, a.b[c].d: a.b[c].d + 1} have a special sugar syntax to remove the duplication? While the above doesn't seem like much with single-letter names, longer variable names can make it get very unwieldy very quickly.

ljharb
ljharb

It is certainly interesting to consider, assignment to a record or tuple would be sugar for creating a new R/T and assigning it to the same binding.

push

ljharb push react-dates/react-dates

ljharb
ljharb

[eslint] fix linting errors

ljharb
ljharb
ljharb
ljharb

[New] {DateRangePicker,SingleDatePicker}{,Input,InputController}: add title text props

Fixes #1861.

ljharb
ljharb

[New] CalendarDay: Add aria-current for "today"

ljharb
ljharb

[Fix] DayPicker: fix check for renderMonthText

Fixes #1993

ljharb
ljharb

[meta] use mkdirp for windows compat

ljharb
ljharb

[Deps] update airbnb-prop-types, enzyme-shallow-equal, object.assign, object.values, react-moment-proptypes, react-outside-click-handler, react-portal

ljharb
ljharb

[Test] DateRangePickerInputController: fix November 6th being seen as June 11th

ljharb
ljharb

[Fix] DateRangePicker: replace sass-specific darken with runtime color calculation

Fixes #1513.

ljharb
ljharb

[Fix] CalendarMonthGrid: Fix iOS 14 navigation

Fixes #2034. Fixes #2050.

ljharb
ljharb

[New] DateRangePicker: pass noBorder as noBorder to DayPickerRangeController

Fixes #1592.

ljharb
ljharb
ljharb
ljharb

[Deps] update color2k, object.values

ljharb
ljharb

[Dev Deps] update @babel/cli, @babel/core, @babel/register, @babel/runtime, @storybook/addon-actions, @storybook/addon-info, @storybook/addon-links, @storybook/addon-options, @storybook/addons, @storybook/react, @welldone-software/why-did-you-render, airbnb-js-shim, aphrodite, babel-eslint, babel-loader, babel-plugin-inline-react-svg, babel-plugin-inline-svg, babel-preset-airbnb, clean-css, coveralls, cross-env, enzyme, enzyme-adapter-react-helper, eslint, eslint-config-airbnb, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-react-with-styles, in-publish, react-with-styles-interface-aphrodite, rimraf, safe-publish-latest, sass-loader, sinon, sinon-sandbox, webpack

ljharb
ljharb

[Fix] DateRangePickerInput: customArrowIcon always overrides RTL or small icon

Fixes #1507. Fixes #1537.

ljharb
ljharb

[Tests] npm run react: use legacy peer deps, due to npm 7

ljharb
ljharb

[Fix] DayPicker: update calendarMonthWeeks if numberOfMonths is changed

Fixes #1394.

Co-authored-by: Lee Mulvey [email protected] Co-authored-by: Jonathan Hao [email protected]

ljharb
ljharb

[Docs] examples: DateRangePickerWrapper/SingleDatePickerWrapper: Add open direction as default props

commit sha: 735f82827098f987c0ae586bcd103f8b613ea54f

push time in 16 hours ago
push

ljharb push react-dates/react-dates

ljharb
ljharb

Add after hovered start class

ljharb
ljharb

Add no-selected-start-before-selected-end and before-hovered-end

ljharb
ljharb

Add selected-start-no-selected-end and selected-end-no-selected-start

ljharb
ljharb

Merge branch 'master' into add-after-hovered-start-class

ljharb
ljharb

Merge branch 'master' into add-after-hovered-start-class

ljharb
ljharb

Merge branch 'master' into add-after-hovered-start-class

ljharb
ljharb

Merge branch 'master' into add-after-hovered-start-class

ljharb
ljharb

Merge branch 'master' into add-after-hovered-start-class

ljharb
ljharb

Merge branch 'master' into add-after-hovered-start-class

ljharb
ljharb

Merge branch 'master' into add-after-hovered-start-class

ljharb
ljharb

Move FontWeight style in DateInput to DefaultTheme

ljharb
ljharb

[Tests] DayPicker: unit test for getWeekHeaders()

ljharb
ljharb

Merge branch 'master' into add-after-hovered-start-class

ljharb
ljharb

Revert "Merge pull request #1758 from airbnb/nora--remove-direct-imports-of-css"

This reverts commit 3e66eba4ba5d0d95bc704e01a32a579e2b1ea5d1, reversing changes made to 8c0ba9886a9f8410f65e65153e5a02e8c987ba08.

ljharb
ljharb

Merge pull request #1818 from airbnb/nora--revert-css-prop

Revert "Merge pull request #1758 from airbnb/nora--remove-direct-imports-of-css"

ljharb
ljharb

Revert "[Tests] DayPicker: unit test for getWeekHeaders()"

This reverts commit 5584f822fdcc3fa266deff62756ac887b4c0d2af.

ljharb
ljharb

Merge pull request #1836 from airbnb/maja-revert-1798

Revert "[Tests] DayPicker: unit test for getWeekHeaders()"

commit sha: 735f82827098f987c0ae586bcd103f8b613ea54f

push time in 16 hours ago
Activity icon
issue

ljharb issue comment nvm-sh/nvm

ljharb
ljharb

macOS Catalina: unable to retrieve the right shell

Operating system and version:

macOS Catalina.

nvm debug output:

as no nvm command becomes available, it's hard to answer this one.

nvm ls output:

as no nvm command becomes available, it's hard to answer this one.

How did you install nvm?

install script in readme

What steps did you perform?

just executed the script in the readme

What happened?

it couldn't find any file to put nvm environment variables, because no ~/.zshrc file was there after a clean Catalina installation.

What did you expect to happen?

I was expecting nvm to check, as last resort, for if [ "$SHELL" = "/bin/zsh" ]; then ... and eventually create by itself the $HOME/.zshrc file with those entries.

Is there anything in any of your profile files that modifies the PATH?

Nope.

ljharb
ljharb

@marklanhamhc please do not pipe the install script to anything but bash; it's explicitly and only designed to run in bash.

Activity icon
issue

ljharb issue airbnb/javascript

ljharb
ljharb

.eslintrc Formatting

When attempting to run eslint-config-airbnb in a gulp task, have been hitting this issue:

Error: Failed to load config "airbnb" to extend from.

Per the docs, did add an .eslintrc file to the project root (same as gulpfile.js), with this code:

"extends": "airbnb"

I'm hitting this error if using it in a .json file:

Error: Unexpected token : in JSON at position 9
    at JSON.parse (<anonymous>)

Or this if .eslintrc.js is used:

  "extends": "airbnb"
           ^

SyntaxError: Unexpected token ':'

I also tried a plain .eslintrc and .eslintrc.yml, and did try different code formats (JS, JSON, YML) for the respective files, but got either the formatting/syntax errors above, or the original error.

System information: Platform/OS: macOS 12.1 / ARM64 Node: 16.3.2 NPM: 8.1.2 eslint-config-airbnb: 19.0.4

Running npm info "[email protected]" peerDependencies will output:

{
  eslint: '^7.32.0 || ^8.2.0',
  'eslint-plugin-import': '^2.25.3',
  'eslint-plugin-jsx-a11y': '^6.5.1',
  'eslint-plugin-react': '^7.28.0',
  'eslint-plugin-react-hooks': '^4.3.0'
}

And all of these dependencies are installed. Anything else to try?

Activity icon
issue

ljharb issue comment airbnb/javascript

ljharb
ljharb

.eslintrc Formatting

When attempting to run eslint-config-airbnb in a gulp task, have been hitting this issue:

Error: Failed to load config "airbnb" to extend from.

Per the docs, did add an .eslintrc file to the project root (same as gulpfile.js), with this code:

"extends": "airbnb"

I'm hitting this error if using it in a .json file:

Error: Unexpected token : in JSON at position 9
    at JSON.parse (<anonymous>)

Or this if .eslintrc.js is used:

  "extends": "airbnb"
           ^

SyntaxError: Unexpected token ':'

I also tried a plain .eslintrc and .eslintrc.yml, and did try different code formats (JS, JSON, YML) for the respective files, but got either the formatting/syntax errors above, or the original error.

System information: Platform/OS: macOS 12.1 / ARM64 Node: 16.3.2 NPM: 8.1.2 eslint-config-airbnb: 19.0.4

Running npm info "[email protected]" peerDependencies will output:

{
  eslint: '^7.32.0 || ^8.2.0',
  'eslint-plugin-import': '^2.25.3',
  'eslint-plugin-jsx-a11y': '^6.5.1',
  'eslint-plugin-react': '^7.28.0',
  'eslint-plugin-react-hooks': '^4.3.0'
}

And all of these dependencies are installed. Anything else to try?

ljharb
ljharb

Yes, it looks like one of those gulp things is incorrectly assuming that eslint config will be valid JSON (.eslintrc supports JSON with comments and trailing commas and optional quotes).

My suggestion would be a) don't run linting as part of your build process, since linting is part of tests, and the build is separate. and b) don't use gulp when it's not necessary - linting can be run as part of an npm run-script command.

I'm going to close this, since it's got nothing to do with the airbnb config.

Activity icon
delete
deleted time in 16 hours ago
pull request

ljharb pull request airbnb/eslint-plugin-react-with-styles

ljharb
ljharb

[New] support `eslint` v8

~Blocked by #47.~

open pull request

ljharb wants to merge import-js/eslint-plugin-import

ljharb
ljharb

[Tests] `no-nodejs-modules`: add tests for node protocol URL

Just add tests

ljharb
ljharb

rather than using semver here, can we use is-core-module to see if each given module is supported?

Previous