profile
viewpoint
Jamie Kyle jamiebuilds @discord Oakland, CA https://jamie.build/ Code Ruins Everything Around Me

fabiospampinato/cash 4722

An absurdly small jQuery alternative for modern browsers.

gaearon/react-transform-boilerplate 3443

A new Webpack boilerplate with hot reloading React components, and error handling on module and component level.

amilajack/eslint-plugin-compat 2474

Lint the browser compatibility of your code

boltpkg/bolt 1735

⚡️ Super-powered JavaScript project management

gaearon/babel-plugin-react-transform 1100

Babel plugin to instrument React components with custom transforms

gaearon/react-transform-hmr 788

A React Transform that enables hot reloading React classes using Hot Module Replacement API

avajs/ava-docs 438

Localized docs for AVA

babel-utils/babel-plugin-tester 201

Utilities for testing babel plugins

gaearon/react-transform-catch-errors 184

React Transform that catches errors inside React components

babel-utils/ast-pretty-print 130

A pretty printer for AST-like structures

created tagjamiebuilds/min-indent

tagv1.0.1

Get the shortest leading whitespace from lines in a string

created time in 2 days

push eventjamiebuilds/min-indent

Jamie Kyle

commit sha f0d5c6c309c964b67c41cd8bf28e6f58058fdc64

1.0.1

view details

push time in 2 days

push eventjamiebuilds/min-indent

Jamie Kyle

commit sha c63f42a7f7c41320f633dd305bf0cd3cedf78deb

fix travis

view details

push time in 2 days

PR merged jamiebuilds/min-indent

Use more efficient minimum length construction

The current Math.min.apply construction throws RangeError: Maximum call stack size exceeded on semi-large files. Here's where we ran in to the issue: https://github.com/sveltejs/svelte-preprocess/issues/143

It's more efficient to use arr.reduce instead.

+1 -1

0 comment

1 changed file

nathancahill

pr closed time in 2 days

push eventjamiebuilds/min-indent

Nathan Cahill

commit sha fa8158dd50256dfc4c30058a17ed63eb122530de

use more efficient minimum length construction

view details

Jamie Kyle

commit sha e8eac7f1ce8f6601f22cd5eda3d20d3d37df7764

fixes

view details

push time in 2 days

push eventjamiebuilds/kokoro

Jamie Kyle

commit sha a0f9545a3dd94f45d417c5188cf17f5feca96cce

Initial commit

view details

push time in 3 days

create barnchjamiebuilds/kokoro

branch : master

created branch time in 3 days

created repositoryjamiebuilds/kokoro

Created with CodeSandbox

created time in 3 days

startedmkay581/cookie-store

started time in 4 days

startedtannerlinsley/react-query

started time in 4 days

push eventjamiebuilds/VisibilityObserver

jamiebuilds

commit sha 8baede05f2d900b0d04acfe7199672ae710d5de3

Deploying to gh-pages from @ d4225d4e76055b78c5d6d10120cab4fedf1b1ec2 🚀

view details

push time in 8 days

created tagjamiebuilds/VisibilityObserver

tagv1.1.0

Experimental API for observing the visible box of an element

created time in 8 days

push eventjamiebuilds/VisibilityObserver

Jamie Kyle

commit sha c9e553863a3beacc01098413c38cc1cca0acf16d

1.1.0

view details

push time in 8 days

push eventjamiebuilds/VisibilityObserver

Jamie Kyle

commit sha d4225d4e76055b78c5d6d10120cab4fedf1b1ec2

export getVisibleRect

view details

push time in 8 days

created tagjamiebuilds/VisibilityObserver

tagv1.0.0

Experimental API for observing the visible box of an element

created time in 8 days

push eventjamiebuilds/VisibilityObserver

Jamie Kyle

commit sha f4abfd1b330c29d21198af1efb9ea4a64547517b

1.0.0

view details

push time in 8 days

push eventjamiebuilds/VisibilityObserver

Jamie Kyle

commit sha ce42c927824708e7f52a559fd860a8a890aa0d7a

demo link

view details

push time in 8 days

startedjamiebuilds/VisibilityObserver

started time in 8 days

push eventjamiebuilds/VisibilityObserver

Jamie Kyle

commit sha 737d5a39377e9d001e63b81e865d8b4a1874a61e

init commit

view details

push time in 8 days

push eventjamiebuilds/VisibilityObserver

jamiebuilds

commit sha be23baed5b728d66fdab9bea0fe9737cfa940f78

Deploying to gh-pages from @ 8085da3e7009afeabbe29fb87dfc9bcba60a61c0 🚀

view details

push time in 8 days

create barnchjamiebuilds/VisibilityObserver

branch : gh-pages

created branch time in 8 days

create barnchjamiebuilds/VisibilityObserver

branch : master

created branch time in 8 days

created repositoryjamiebuilds/VisibilityObserver

Experimental API for observing the visible box of an element

created time in 8 days

issue commentromejs/rome

React lint rules

Does <> have a key syntax yet?

sebmck

comment created time in 10 days

issue commentromejs/rome

React lint rules

So here's a list of things we generally want to avoid:

  • Rules specific to APIs that have been deprecated for awhile React.createClass/etc
  • Rules where they are not useful (or not useful enough) without some additional configuration (Example: react/forbid-component-props)
  • Rules for things that are/can be handled by the formatter in Rome (Example: react/jsx-curly-newline)
  • Rules that enforce "silly" syntactic things, like sorting object properties, or forcing you to use one syntax over another without any concrete benefits (Example: react/function-component-definition)
  • Rules that try to enforce something that they can't really enforce without things like a type-information or side-effect tracking. (Example: react/no-access-state-in-setstate doesn't enforce the thing its trying to enforce)
  • Rules that aren't necessary in Rome (Example: react/jsx-uses-react)

If you have a question about a particular lint rule, please reach out and ask about it before you go and implement it

sebmck

comment created time in 11 days

pull request commentromejs/rome

Remove Flow syntax support

:+1: Yup totally support this. Flow might as well be closed source at this point.

I know people (including myself for a long time) really wanted Flow to be successful because of the design of its type system. But the Flow only qualifies as open source by a technicality.

If you really want to see an alternative to TypeScript you should focus your energies on something like Elm, PureScript, or one of the many other languages designed to fill the JavaScript/Web role.

sebmck

comment created time in 14 days

issue openedfacebookexperimental/Recoil

Forgetting atoms

I was wondering if we could get some detail about how/when things get removed from Recoil's internal cache. Does Recoil have internal reference counting? I see some code about persistence, but it's hard to follow without any context.

There's also the recommendation to use a memoize function like the itemWithId example from the React Europe talk. Is Recoil going to have a memoization mechanism? Otherwise, how should we manage when to remove things from our memoization cache?

created time in 14 days

delete branch jamiebuilds/Recoil

delete branch : patch-2

delete time in 16 days

delete branch jamiebuilds/Recoil

delete branch : patch-1

delete time in 16 days

issue commentromejs/rome

Hard Tabs

Just to confirm the accessibility issue: https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/

coworkers who unfortunately are highly visually impaired, and each has a different visual impairment:

  • one of them uses tab-width 1 because he uses such a gigantic font-size
  • the other uses tab-width 8 and a really wide monitor
  • these guys have serious problems using codebases with spaces, they have to convert, do their work, and then unconvert before committing
jamiebuilds

comment created time in 16 days

PR opened facebookexperimental/Recoil

Add missing async keyword
+1 -1

0 comment

1 changed file

pr created time in 16 days

push eventjamiebuilds/Recoil

Jamie Kyle

commit sha 17f5a6e01efd15bf737d015df7ae5a3d302e4fb2

Add missing async keyword

view details

push time in 16 days

PR opened facebookexperimental/Recoil

Set correct edit urls
+2 -4

0 comment

1 changed file

pr created time in 16 days

push eventjamiebuilds/Recoil

Jamie Kyle

commit sha 17f574c1011c80dabd04672b7125730131764366

Set correct edit urls

view details

push time in 16 days

fork jamiebuilds/Recoil

Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.

fork in 16 days

issue openedromejs/rome

Hard Tabs

People are allowed to have opinions on how much visual indentation they want in their code. When I first started coding I found 4-space indentation to be really helpful when I would easily get lost in my code. After a few years I preferred 2-spaces. So there is an argument to be made about accessibility.

People have debated endlessly about tabs vs spaces, and ultimately most of people's opinions are just a bit silly. There is only one consequential difference between the two:

Tabs allow individuals in the same codebase to select their indentation widths across every tool (yes including GitHub using either the .editorconfig or a user-style with tab-size), and spaces do not (at least not across every tool).

As such, I think we should switch to hard tabs for everything in Rome.

I'm gonna make a request that people refrain from flooding this thread with subjective opinions about if 2-space width code is better than 4-space width code. You are welcome to have your personal preference, that is the entire reason for choosing hard tabs.

created time in 17 days

issue openedseleb/eslint-plugin-no-smart-quotes

Support more types of "smart quotes"

https://unicodelookup.com/#quo

created time in 18 days

Pull request review commentseleb/eslint-plugin-no-smart-quotes

Make rule fixable

 module.exports = {                     return;                 } -                const match = node.raw.match(/^(.*(“|”|‘|’).*)$/);--                if (match) {-                    const offendingPunctuation = match[2];-                    const matchedString = match[1];-                    const alternate = {-                        '“': '"',-                        '”': '"',-                        '‘': "'",-                        '’': "'",-                    } [offendingPunctuation];--                    if (typeof matchedString !== 'undefined' && typeof offendingPunctuation !== 'undefined') {-                        const message = `Strings must use straight quotes in: ${ matchedString}. Use ${alternate} instead.`;-                        context.report({-                            node,-                            message: message,-                            data: {-                                offendingPunctuation-                            }-                        });-                    }+                const matches = Array.from(matchAll(node.raw, SMART_QUOTES_REGEX));++                if (matches.length === 0) {+                    return;                 }++                context.report({+                    node,+                    message: "Strings must use straight quotes.",+                    fix(fixer) {+                        const stringQuoteType = node.raw.charAt(0);++                        let fixed = ""+                        let matchIndex = 0;++                        for (let index = 0; index < node.raw.length; index++) {+                            let char = node.raw.charAt(index);+                            const match = matches[matchIndex];++                            if (match && index === match.index) {+                                matchIndex++;++                                let replacement = REPLACEMENTS[match[0]];++                                if (replacement) {+                                    if (replacement === stringQuoteType) {+                                        replacement = '\\' + replacement;

Need to escape here so that it doesn't replace "“" with """ (invalid syntax)

jamiebuilds

comment created time in 18 days

Pull request review commentseleb/eslint-plugin-no-smart-quotes

Make rule fixable

 module.exports = {                     return;                 } -                const match = node.raw.match(/^(.*(“|”|‘|’).*)$/);--                if (match) {-                    const offendingPunctuation = match[2];-                    const matchedString = match[1];-                    const alternate = {-                        '“': '"',-                        '”': '"',-                        '‘': "'",-                        '’': "'",-                    } [offendingPunctuation];--                    if (typeof matchedString !== 'undefined' && typeof offendingPunctuation !== 'undefined') {-                        const message = `Strings must use straight quotes in: ${ matchedString}. Use ${alternate} instead.`;-                        context.report({-                            node,-                            message: message,-                            data: {-                                offendingPunctuation-                            }-                        });-                    }+                const matches = Array.from(matchAll(node.raw, SMART_QUOTES_REGEX));++                if (matches.length === 0) {+                    return;                 }++                context.report({+                    node,+                    message: "Strings must use straight quotes.",+                    fix(fixer) {+                        const stringQuoteType = node.raw.charAt(0);++                        let fixed = ""+                        let matchIndex = 0;++                        for (let index = 0; index < node.raw.length; index++) {+                            let char = node.raw.charAt(index);+                            const match = matches[matchIndex];++                            if (match && index === match.index) {+                                matchIndex++;++                                let replacement = REPLACEMENTS[match[0]];++                                if (replacement) {+                                    if (replacement === stringQuoteType) {+                                        replacement = '\\' + replacement;+                                    }++                                    char = replacement;+                                }+                            }++                            fixed += char;+                        }++                        return [+                            fixer.replaceTextRange([node.start, node.end], fixed),

I replace the entire string at once rather than individual slices of the string.

jamiebuilds

comment created time in 18 days

Pull request review commentseleb/eslint-plugin-no-smart-quotes

Make rule fixable

 module.exports = {                     return;                 } -                const match = node.raw.match(/^(.*(“|”|‘|’).*)$/);--                if (match) {-                    const offendingPunctuation = match[2];-                    const matchedString = match[1];-                    const alternate = {-                        '“': '"',-                        '”': '"',-                        '‘': "'",-                        '’': "'",-                    } [offendingPunctuation];--                    if (typeof matchedString !== 'undefined' && typeof offendingPunctuation !== 'undefined') {-                        const message = `Strings must use straight quotes in: ${ matchedString}. Use ${alternate} instead.`;-                        context.report({-                            node,-                            message: message,-                            data: {-                                offendingPunctuation-                            }-                        });-                    }+                const matches = Array.from(matchAll(node.raw, SMART_QUOTES_REGEX));++                if (matches.length === 0) {+                    return;                 }++                context.report({+                    node,+                    message: "Strings must use straight quotes.",+                    fix(fixer) {+                        const stringQuoteType = node.raw.charAt(0);++                        let fixed = ""+                        let matchIndex = 0;++                        for (let index = 0; index < node.raw.length; index++) {

Note: This loop is a little bit complicated in order to make sure that replacing with \" doesn't screw up the current string index.

jamiebuilds

comment created time in 18 days

Pull request review commentseleb/eslint-plugin-no-smart-quotes

Make rule fixable

 module.exports = {                     return;                 } -                const match = node.raw.match(/^(.*(“|”|‘|’).*)$/);--                if (match) {-                    const offendingPunctuation = match[2];-                    const matchedString = match[1];-                    const alternate = {-                        '“': '"',-                        '”': '"',-                        '‘': "'",-                        '’': "'",-                    } [offendingPunctuation];--                    if (typeof matchedString !== 'undefined' && typeof offendingPunctuation !== 'undefined') {-                        const message = `Strings must use straight quotes in: ${ matchedString}. Use ${alternate} instead.`;-                        context.report({-                            node,-                            message: message,-                            data: {-                                offendingPunctuation-                            }-                        });-                    }+                const matches = Array.from(matchAll(node.raw, SMART_QUOTES_REGEX));++                if (matches.length === 0) {+                    return;                 }++                context.report({+                    node,+                    message: "Strings must use straight quotes.",

I simplified the message since it is fixable now. This seems to be consistent with other fixable rules, and since I'm matching multiple things at once it doesn't make since to suggest a single character replacement.

jamiebuilds

comment created time in 18 days

Pull request review commentseleb/eslint-plugin-no-smart-quotes

Make rule fixable

 module.exports = {                     return;                 } -                const match = node.raw.match(/^(.*(“|”|‘|’).*)$/);--                if (match) {-                    const offendingPunctuation = match[2];-                    const matchedString = match[1];-                    const alternate = {-                        '“': '"',-                        '”': '"',-                        '‘': "'",-                        '’': "'",-                    } [offendingPunctuation];--                    if (typeof matchedString !== 'undefined' && typeof offendingPunctuation !== 'undefined') {-                        const message = `Strings must use straight quotes in: ${ matchedString}. Use ${alternate} instead.`;-                        context.report({-                            node,-                            message: message,-                            data: {-                                offendingPunctuation-                            }-                        });-                    }+                const matches = Array.from(matchAll(node.raw, SMART_QUOTES_REGEX));

I'm now matching every smart quote in the string at once (using matchAll) so much of the rule has been updated around that.

jamiebuilds

comment created time in 18 days

Pull request review commentseleb/eslint-plugin-no-smart-quotes

Make rule fixable

 module.exports = {             category: "Stylistic Issues",             recommended: false         },-        fixable: null, // or "code" or "whitespace"+        fixable: "code",         schema: [             // fill in your schema         ]     },      create: function (context) { -        // variables should be defined here

Hoisted the variables here since it says to

jamiebuilds

comment created time in 18 days

PR opened seleb/eslint-plugin-no-smart-quotes

Make rule fixable

I'll annotate the PR...

+108 -51

0 comment

6 changed files

pr created time in 18 days

create barnchdiscord/eslint-plugin-no-smart-quotes

branch : fixable

created branch time in 18 days

delete branch jamiebuilds/next.js

delete branch : patch-1

delete time in 19 days

PR opened zeit/next.js

Reviewers
Use an if statement instead of long ass expression

Let an optimizing compiler minify the code :P

+4 -1

0 comment

1 changed file

pr created time in 19 days

push eventjamiebuilds/next.js

Jamie Kyle

commit sha 8d1aab3b9c516e6803eb76b045a97028b22bd3dd

Use an if statement instead of long ass expression Let an optimizing compiler minify the code :P

view details

push time in 19 days

startedorta/Snapshots-Peek

started time in 19 days

issue commentfacebookexperimental/rome

Logo

Screen Shot 2020-05-08 at 2 33 13 PM

I would like to play around more with the weight and detail to make it feel more substantive

sebmck

comment created time in 22 days

issue commentfacebookexperimental/rome

Logo

So personally I think we should avoid doubling down on Rome imagery, because I don't think we should be trying to invoke the literal "Rome: The City". We're trying to invoke "Rome: The Tool".

I think we should take a step back and ask what we want out of Rome's identity:

  • Bold
  • Stable
  • Exciting
  • etc.

And then we should look for inspiration out of what Rome is actually doing:

  • Converging many different tools into one
  • Hitting the reset button on the JavaScript ecosystem
  • Improving developer experience
  • etc.

"Rome: The Place" should a lower priority thing that we only integrate if we can do so in a clever way.

Otherwise it's gonna keep feeling like we're forcing "Rome: The Place" onto the something that has little to do with it.

sebmck

comment created time in 23 days

push eventjamiebuilds/unstated-next

Jamie Kyle

commit sha 15329b5962771b475c5beb48f6a6fee2d56c1bfb

Update unstated-next.tsx

view details

push time in a month

push eventjamiebuilds/unstated-next

Jamie Kyle

commit sha d74dd3380f9e54bbe20dd5b6c8faeb5ba6011c42

Update unstated-next.tsx

view details

push time in a month

push eventjamiebuilds/unstated-next

Kevin Wolf

commit sha a1b2d71f8c914966e485aba62fe0ef8cc3839d83

Initialize context with symbol value (#72)

view details

push time in a month

PR merged jamiebuilds/unstated-next

Initialize context with symbol value

The problem

Sometimes, a user may want the context to return a null value (i.e. getting an authenticated user). Since the library throws an error if the context value is null, this is not currently possible.

This solution

This PR updates the initial context value to be a unique symbol, so if the context value is null, it won't throw an error.

+34 -13

5 comments

2 changed files

kevinwolfdev

pr closed time in a month

PR closed jamiebuilds/react-loadable

Found a typo

Dear Maintainer

I just found a typo. In example code, it delays 0.3s while in text it shows 300ms.

Best Regards,

Frank

+1 -1

1 comment

1 changed file

frankda

pr closed time in a month

pull request commentjamiebuilds/react-loadable

Found a typo

It does default to 200ms: https://github.com/jamiebuilds/react-loadable/blob/master/src/index.js#L109

The following example is showing how to override it to 300

frankda

comment created time in a month

pull request commentfacebookexperimental/rome

Add inline snapshot support

289723CB-1B1D-418E-895B-3A553CBC48A5

sebmck

comment created time in a month

issue commenttudorgergely/use-scroll-to-bottom

Allow ref to be passed in and simplify API

Why are you moving the ref around elements on the screen at the same time? That's going to lead you into all sorts of traps with React.

It's easier and far safer to do this:

let ref1 = useRef()
let ref2 = useRef()

let isBottom1 = useScrollToBottom(ref1)
let isBottom2 = useScrollToBottom(ref2)

return (
  <>
    <div ref={ref1}>...</div>
    <div ref={ref2}>...</div>
  </>
)
jamiebuilds

comment created time in a month

issue commenttudorgergely/use-scroll-to-bottom

Allow ref to be passed in and simplify API

The only thing that is going to change the ref is the component re-rendering, so you don’t need to watch it

jamiebuilds

comment created time in a month

issue openedtudorgergely/use-scroll-to-bottom

Allow ref to be passed in and simplify API

A lot of the time when you are working with scrollers you end up wanting to a number of different things with it. For this, you're gonna want to use a single ref everywhere.

So I think it would be generally better if use-scroll-to-bottom accepted a ref instead of providing a setter:

function MyComponent() {
  let ref = useRef()
  let isBottom = useScrollToBottom(ref)

  useEffect(() => {
    // do my own stuff with ref...
  })

  useOtherScrollerLibrary(ref)

  return (
    <div className="simple-container">
      <div className="big-element">
        {isBottom && "Bottom reached"}
      </div>
      <div ref={ref}>Bottom</div>
    </div>
  )
}

Also, I'm fairly certain that by using a setState function you are causing an unnecessary double render. So at the very least, you're better off returning a ref object instead of a setState method.

created time in a month

pull request commentjamiebuilds/unstated-next

Initialize context with undefined value

Hm, I forget how I solved that previously. But alternatively, you could use unique symbol:

const EMPTY: unique symbol = Symbol()

function fn<Value>(value: typeof EMPTY | Value): Value {
  if (value === EMPTY) {
    throw new Error()
  }

  return value
}
kevinwolfdev

comment created time in a month

pull request commentjamiebuilds/unstated-next

Initialize context with undefined value

Better yet you can create an opaque value with an empty object, and rely on referential equality to throw:

let EMPTY = {} // opaque value

useContext<Value | typeof EMPTY>(EMPTY)

if (value === EMPTY) {
  throw
}
kevinwolfdev

comment created time in a month

issue commentzeit/swr

Type safety with dependent fetching

Personally I'd rather see the error trick go away, but I'd also like a convenient API. So I'm probably gonna stick with the template string either way.

I think the docs might be better off advising people to return null all the time.

jamiebuilds

comment created time in a month

pull request commentfacebookexperimental/rome

Add autofix for preferTemplate rule

@ooflorent Yup, that's what this code is doing https://github.com/facebookexperimental/rome/pull/187/files#diff-a4c9c2d24510abf7ef39564000f44422R229-R243

jamiebuilds

comment created time in a month

MemberEvent

push eventjamiebuilds/codeowners-utils

Kyle Welch

commit sha 976f0d408a60406c383bb742eaa1e0dcd0354e50

Fix find owners (#5)

view details

push time in a month

PR merged jamiebuilds/codeowners-utils

Fix find owners

The newer version of locate path does not match loosely so upgrading it caused a failure when finding the git dir, which caused it to not find the CODEOWNERS file.

I also added deps to the package.json, I am open to doing that differently.

+193 -62

0 comment

3 changed files

kwelch

pr closed time in a month

issue commentzeit/swr

Type safety with dependent fetching

Maybe it could work like this?

let { data: user } = useSWR('/api/user')
let { data: projects } = useSWR(t => t`/api/projects?user=${user?.id}`)
jamiebuilds

comment created time in a month

issue openedzeit/swr

Type safety with dependent fetching

Right now SWR depends on throwing errors in order to do dependent fetching:

import useSWR from 'swr'

function MyProjects () {
  const { data: user } = useSWR('/api/user')
  const { data: projects } = useSWR(
    () => '/api/projects?uid=' + user.id
  )
  // When passing a function, SWR will use the
  // return value as `key`. If the function throws,
  // SWR will know that some dependencies are not
  // ready. In this case it is `user`.

  if (!projects) return 'loading...'
  return 'You have ' + projects.length + ' projects'
}

However, tools like TypeScript are specifically designed so you never write code like this, making it really awkward to force your type checker to allow an error to be thrown:

const { data: projects } = useSWR(
  () => '/api/projects?uid=' + (user as any).id
)

In order to get around this, I've written a template tag which allows you to safely construct strings with nullable values:

let { data: user } = useSWR('/api/user.json')
let { data: projects } = useSWR(
  safestring`/api/users/${user?.id}/projects.json`,
)

safestring will only return a string if every interpolated value is not null or undefined, otherwise it will return null which makes it work with no additional changes to useSWR.

Today's API in SWR is awkward even if you aren't using a type checker though. There are times when JavaScript isn't going to throw an error when you would expect it to. For example:

// This won't throw an error if `[0]` does not exist
useSWR(() => '/api/books/' + bookIds[0])

// Instead you need to throw an error (or return null):
useSWR(() => {
  let first = bookIds[0]
  if (first) return '/api/books/' + bookIds[0]
  throw new Error()
})

These manual checks really undo any benefits of having this implicit-error-based API.

Here is an implementation of safestring:

export type SafeStringArg = string | number | null | undefined

export default function safestring(
  strings: TemplateStringsArray,
  ...args: SafeStringArg[]
): string | null {
  let result = strings[0]
  for (let index = 0; index < args.length; index++) {
    if (args[index] == null) return null
    result += args[index] + strings[index + 1]
  }
  return result
}

I don't mind having this outside of SWR, but I just want to offer this up as a potential improvement to the API.

created time in a month

Pull request review commentfacebookexperimental/rome

Add autofix for preferTemplate rule

 console.log(`${foo}baz`); ### `1: formatted`  ```-console.log(`${1 * 2}baz`);+console.log(`${1 * 2}foo`);++```++### `2`++```++ unknown:1:12 lint/preferTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++  ✖ Template literals are preferred over string concatenation++    console.log(1 + 'foo' + 2 + 'bar' + 'baz' + 3)+                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++  ℹ Recommended fix++  - 1·+·'foo'·+·2·+·'bar'·+·'baz'·+·3+  + `${1}foo${2}barbaz${3}`++━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++✖ Found 1 problem++```++### `2: formatted`++```+console.log(`${1}foo${2}barbaz${3}`);++```++### `3`++```++ unknown:1:13 lint/preferTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++  ✖ Template literals are preferred over string concatenation++    console.log((1 + 'foo') * 2)+                 ^^^^^^^^^ ++  ℹ Recommended fix++  - 1·+·'foo'+  + `${1}foo`++━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++✖ Found 1 problem++```++### `3: formatted`++```+console.log(`${1}foo` * 2);++```++### `4`++```++ unknown:1:12 lint/preferTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++  ✖ Template literals are preferred over string concatenation++    console.log((1 * (2 + 'foo')) + 'bar')+                ^^^^^^^^^^^^^^^^^^^^^^^^^ ++  ℹ Recommended fix++  - (1 * (2 + 'foo'))·+·'bar'+  + `${1 * (2 + 'foo')}bar`++ unknown:1:18 lint/preferTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++  ✖ Template literals are preferred over string concatenation++    console.log((1 * (2 + 'foo')) + 'bar')+                      ^^^^^^^^^ ++  ℹ Recommended fix++  - 2·+·'foo'+  + `${2}foo`++━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++✖ Found 2 problems++```++### `4: formatted`++```+console.log(`${1 * `${2}foo`}bar`);++```++### `5`++```+✔ No known problems!++```++### `5: formatted`++```+console.log('foo' + 'bar');++```++### `6`++```++ unknown:1:12 lint/preferTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++  ✖ Template literals are preferred over string concatenation++    console.log(`foo` + 1)+                ^^^^^^^^^ ++  ℹ Recommended fix++  - `foo`·+·1+  + `foo${1}`++━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++✖ Found 1 problem++```++### `6: formatted`++```+console.log(`foo${1}`);++```++### `7`++```++ unknown:1:12 lint/preferTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++  ✖ Template literals are preferred over string concatenation++    console.log('foo' + `bar${`baz${'bat' + 'bam'}`}` + 'boo')+                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++  ℹ Recommended fix++  - 'foo'·+·`bar${`baz${'bat' + 'bam'}`}`·+·'boo'+  + `foobarbaz${'bat' + 'bam'}boo`++━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++✖ Found 1 problem++```++### `7: formatted`++```+console.log(`foobarbaz${'bat' + 'bam'}boo`);++```++### `8`++```++ unknown:1:12 lint/preferTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++  ✖ Template literals are preferred over string concatenation++    console.log('foo' + 1 + 2)+                ^^^^^^^^^^^^^ ++  ℹ Recommended fix++  - 'foo'·+·1·+·2+  + `foo${1}${2}`++━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━++✖ Found 1 problem++```++### `8: formatted`++```+console.log(`foo${1}${2}`);

btw I feel like these x: formatted bits should just be inline assertions instead of snapshots. I kept overwriting them and having to re-check they were all what I wanted them to be.

await testLint(t, {
   input: 'console.log("foo" + 1 + 2);',
   expected: 'console.log(`foo${1}${2}`);',
   category: 'lint/preferTemplate',
});
jamiebuilds

comment created time in a month

pull request commentfacebookexperimental/rome

Add autofix for preferTemplate rule

TODO:

  • Strip loc information where necessary
  • Figure out how to handle comments in positions they can't be in anymore (bail?)
jamiebuilds

comment created time in a month

push eventjamiebuilds/rome

Jamie Kyle

commit sha 7dea368a0fca0fb0640f15ea6aceed487274c470

Support combining existing template literals

view details

Jamie Kyle

commit sha 90e86de93b550df524a67b30be1c82f5346d13b4

Fix template quasis bug

view details

Jamie Kyle

commit sha 7e5705954f657bd3c63433fd30cbab476a986156

re-run linter on codebase

view details

push time in a month

push eventjamiebuilds/rome

Jamie Kyle

commit sha 78223f7252f91db2bd48e8cb9f8c371493f65aa7

Add autofix for preferTemplate rule

view details

push time in a month

push eventjamiebuilds/rome

Jamie Kyle

commit sha 71cac3e1767d1f39e2d4475caca4a805cc0beb34

Add autofix for preferTemplate rule

view details

push time in a month

startedfacebookexperimental/rome

started time in a month

push eventjamiebuilds/rome

Jamie Kyle

commit sha a948211a53ddce17dc42541b13a9a09903def651

Add autofix for preferTemplate rule

view details

push time in a month

push eventjamiebuilds/rome

Mareike Täubner

commit sha 4c09d77fd359915213be1939e0f9818af0a87879

added docs for init and lint commands

view details

Mareike Täubner

commit sha 66255fd28c3b5fa69ccac00fd58f852936e6dc08

improved grammar

view details

Mareike Täubner

commit sha 4bc758305f64f0a093b6335a72e0808063707824

added instructions on which keys to press for each step

view details

Mareike Täubner

commit sha 20cd77c0940ba7afe97acbc932496b2fd493cc17

improved language rzigs instructions

view details

Mareike Täubner

commit sha 495a8fa3005777a0134985cb8ee3bbf0bf762de6

removed the commands header

view details

Mareike Täubner

commit sha ee95523fa1218258dae6c7d8ab9a1d95aefaa323

update init script docs

view details

macovedj

commit sha 27799e31d51ad3e07b848cae5ce96d595008b1e9

Merge pull request #7 from facebookexperimental/master catch up with base

view details

macovedj

commit sha 76397de2c8e8bd6881064d39b1bdce31ad2fce5a

implement no-duplicate-import-source lint rule

view details

Michael Lancaster

commit sha fc7cb6cf371d38fefa53097d76087b814a80bef7

fix linting issues on changes related to noExAssign

view details

macovedj

commit sha 9be8e04e12bfee7b20ffa8afbc0ef765cdf62698

diagnose duplicate source at violation rather than program node

view details

macovedj

commit sha 65e4a690b5978c394848d6bf0a3f4087c05e3a95

Merge pull request #8 from facebookexperimental/master catch up with base

view details

macovedj

commit sha a1abfa41be6a4c104a2a29a86172bbb849b78877

Merge branch 'master' into duplicate-import-source

view details

macovedj

commit sha 44322079057c3183462214b14f0e04b9a0312435

reorg after catching up wiht master

view details

ChrisDillinger

commit sha 8faba606d5d11b45a3a09f577668c6ecde0d1b4b

feat(parseOperator & parseQuantifier): '{' is parsed as Operator and parseQuantifier correctly advances This updates parseOperator and parseQuantifier to correctly handle {n} and {n,n} quantifiers. parseQuantifier needs to advance to next token for the two edge cases where it finds its closing '}' token. Otherwise, the parser will re-create a character token for that '}' that is really just a part of the quantifier.

view details

Andrew Qu

commit sha 1bff509338521c677d8dc1f0ed6e20de978ee882

Removed $ bash code block prefix

view details

ChrisDillinger

commit sha 0b0258fe63f57cc39da8004e879c5a3b21c68e92

style(codec-js-regexp): moved comments inside branches

view details

macovedj

commit sha c38818071b6a1c80d3e2b11aa3eae0bb55caf702

fix typescript errors and silly conflict resolution mistakes

view details

Sebastian McKenzie

commit sha 0b7fc5f3ba3af003b141b6484689caa700dca777

Simplify diagnostics

view details

Sebastian McKenzie

commit sha 612b8cbd8c01681363567aa874ca978a1e284ab6

Update tests

view details

Mareike Täubner

commit sha d268f911e078d4eccd732ff9f303ce18673c799b

updated init command docs

view details

push time in a month

push eventdiscord/use-memo-value

Jamie Kyle

commit sha af91650bb26ef3a7c90b1fae2b440c5f4d2587d4

--inline none

view details

push time in a month

issue commentfacebookexperimental/rome

React lint rules

Here's a list of all the potential rules, with info on what if they are in the "recommended" set and what their setting is in Create React App:

React rules

JSX-specific rules

sebmck

comment created time in a month

issue commentintegrations/slack

Feature Request: Subscribing to only certain users/teams

(kicking bot)

jamiebuilds

comment created time in a month

startedjdan/98.css

started time in a month

created tagdiscord/use-memo-value

tagv1.0.1

Reuse the previous version of a value unless it has changed

created time in a month

push eventdiscord/use-memo-value

Jamie Kyle

commit sha bf325ffdec643efa8cfe8574e050cbdf286727c0

1.0.1

view details

push time in a month

push eventdiscord/use-memo-value

Jamie Kyle

commit sha a4ea6994e88d7111ebcb129054ea5faa8a35f75e

Make safe in concurrent mode

view details

push time in a month

push eventdiscord/use-memo-value

Jamie Kyle

commit sha 9a124fcfb1fbb69460e6d929f1ce3bdcbdebab7a

Make safe in concurrent mode

view details

push time in a month

PR closed jamiebuilds/react-loadable

Reademe.md

<a href="https://onlinenetbanking.in/">OnlineNetBanking</a>

+1 -0

0 comment

1 changed file

OnlineNetBanking

pr closed time in a month

starteddiscord/use-memo-value

started time in a month

push eventdiscord/use-memo-value

Jamie Kyle

commit sha 4b4b2051fc4704e7d6a8d992c4cf78d024273b0f

1.0.0

view details

push time in a month

created tagdiscord/use-memo-value

tagv1.0.0

Reuse the previous version of a value unless it has changed

created time in a month

create barnchdiscord/use-memo-value

branch : master

created branch time in a month

created repositorydiscord/use-memo-value

Reuse the previous version of a value unless it has changed

created time in a month

created tagdiscord/babel-plugin-define-patterns

tagv1.0.0

Create constants that replace various expressions at build-time

created time in a month

push eventdiscord/babel-plugin-define-patterns

Jamie Kyle

commit sha 6d975c00a47151d2db9d4f3685deece83fdbf815

1.0.0

view details

push time in a month

starteddiscord/babel-plugin-define-patterns

started time in a month

create barnchdiscord/babel-plugin-define-patterns

branch : master

created branch time in a month

created repositorydiscord/babel-plugin-define-patterns

Create constants that replace various expressions at build-time

created time in a month

created tagbabel-utils/babel-identifiers

tagv2.0.1

Classify Babel identifiers

created time in a month

push eventbabel-utils/babel-identifiers

Jamie Kyle

commit sha ffa951b00038cdb186bdd39938f1ea572a689479

2.0.1

view details

push time in a month

more