repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/sv.js | dist/locale/sv.js | //! moment.js locale configuration
//! locale : Swedish [sv]
//! author : Jens Alm : https://github.com/ulmus
import moment from '../moment';
export default moment.defineLocale('sv', {
months: 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split(
'_'
),
mon... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/ar-ps.js | dist/locale/ar-ps.js | //! moment.js locale configuration
//! locale : Arabic (Palestine) [ar-ps]
//! author : Majd Al-Shihabi : https://github.com/majdal
import moment from '../moment';
var symbolMap = {
1: '١',
2: '٢',
3: '٣',
4: '٤',
5: '٥',
6: '٦',
7: '٧',
8: '٨',
... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/ca.js | dist/locale/ca.js | //! moment.js locale configuration
//! locale : Catalan [ca]
//! author : Juan G. Hurtado : https://github.com/juanghurtado
import moment from '../moment';
export default moment.defineLocale('ca', {
months: {
standalone:
'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/ka.js | dist/locale/ka.js | //! moment.js locale configuration
//! locale : Georgian [ka]
//! author : Irakli Janiashvili : https://github.com/IrakliJani
import moment from '../moment';
export default moment.defineLocale('ka', {
months: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.spli... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/en-au.js | dist/locale/en-au.js | //! moment.js locale configuration
//! locale : English (Australia) [en-au]
//! author : Jared Morse : https://github.com/jarcoal
import moment from '../moment';
export default moment.defineLocale('en-au', {
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/oc-lnc.js | dist/locale/oc-lnc.js | //! moment.js locale configuration
//! locale : Occitan, lengadocian dialecte [oc-lnc]
//! author : Quentin PAGÈS : https://github.com/Quenty31
import moment from '../moment';
export default moment.defineLocale('oc-lnc', {
months: {
standalone:
'genièr_febrièr_març_abril_mai_junh_julhet_agost_... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/ss.js | dist/locale/ss.js | //! moment.js locale configuration
//! locale : siSwati [ss]
//! author : Nicolai Davies<mail@nicolai.io> : https://github.com/nicolaidavies
import moment from '../moment';
export default moment.defineLocale('ss', {
months: "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/uk.js | dist/locale/uk.js | //! moment.js locale configuration
//! locale : Ukrainian [uk]
//! author : zemlanin : https://github.com/zemlanin
//! Author : Menelion Elensúle : https://github.com/Oire
import moment from '../moment';
function plural(word, num) {
var forms = word.split('_');
return num % 10 === 1 && num % 100 !== 11
... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/ar-ma.js | dist/locale/ar-ma.js | //! moment.js locale configuration
//! locale : Arabic (Morocco) [ar-ma]
//! author : ElFadili Yassine : https://github.com/ElFadiliY
//! author : Abdel Said : https://github.com/abdelsaid
import moment from '../moment';
export default moment.defineLocale('ar-ma', {
months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يولي... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/gl.js | dist/locale/gl.js | //! moment.js locale configuration
//! locale : Galician [gl]
//! author : Juan G. Hurtado : https://github.com/juanghurtado
import moment from '../moment';
export default moment.defineLocale('gl', {
months: 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split(
'_... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/mn.js | dist/locale/mn.js | //! moment.js locale configuration
//! locale : Mongolian [mn]
//! author : Javkhlantugs Nyamdorj : https://github.com/javkhaanj7
import moment from '../moment';
function translate(number, withoutSuffix, key, isFuture) {
switch (key) {
case 's':
return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/uz.js | dist/locale/uz.js | //! moment.js locale configuration
//! locale : Uzbek [uz]
//! author : Sardor Muminov : https://github.com/muminoff
import moment from '../moment';
export default moment.defineLocale('uz', {
months: 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split(
'_'
),
monthsShort... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/en-ca.js | dist/locale/en-ca.js | //! moment.js locale configuration
//! locale : English (Canada) [en-ca]
//! author : Jonathan Abourbih : https://github.com/jonbca
import moment from '../moment';
export default moment.defineLocale('en-ca', {
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/ja.js | dist/locale/ja.js | //! moment.js locale configuration
//! locale : Japanese [ja]
//! author : LI Long : https://github.com/baryon
import moment from '../moment';
export default moment.defineLocale('ja', {
eras: [
{
since: '2019-05-01',
offset: 1,
name: '令和',
narrow: '㋿',
... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/uz-latn.js | dist/locale/uz-latn.js | //! moment.js locale configuration
//! locale : Uzbek Latin [uz-latn]
//! author : Rasulbek Mirzayev : github.com/Rasulbeeek
import moment from '../moment';
export default moment.defineLocale('uz-latn', {
months: 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split(
'_'
)... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/dist/locale/ku.js | dist/locale/ku.js | //! moment.js locale configuration
//! locale : Kurdish [ku]
//! author : Shahram Mebashar : https://github.com/ShahramMebashar
import moment from '../moment';
var symbolMap = {
1: '١',
2: '٢',
3: '٣',
4: '٤',
5: '٥',
6: '٦',
7: '٧',
8: '٨',
9: '... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/min/locales.js | min/locales.js | ;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
&& typeof require === 'function' ? factory(require('../moment')) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | true |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/min/moment-with-locales.js | min/moment-with-locales.js | ;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.moment = factory()
}(this, (function () { 'use strict';
var hookCallback;
function hooks() {
retu... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | true |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/min/moment-with-locales.min.js | min/moment-with-locales.min.js | !function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.moment=a()}(this,function(){"use strict";var E;function c(){return E.apply(null,arguments)}function F(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | true |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/min/tests.js | min/tests.js |
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
&& typeof require === 'function' ? factory(require('../../moment')) :
typeof define === 'function' && define.amd ? define(['../../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use st... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | true |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/min/locales.min.js | min/locales.min.js | !function(e,a){"object"==typeof exports&&"undefined"!=typeof module&&"function"==typeof require?a(require("../moment")):"function"==typeof define&&define.amd?define(["../moment"],a):a(e.moment)}(this,function(e){"use strict";e.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | true |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/min/moment.min.js | min/moment.min.js | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var H;function _(){return H.apply(null,arguments)}function y(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | true |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/meteor/moment.js | meteor/moment.js | //! moment.js
//! version : 2.30.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(fac... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | true |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/meteor/export.js | meteor/export.js | // moment.js makes `moment` global on the window (or global) object, while Meteor expects a file-scoped global variable
moment = this.moment;
try {
delete this.moment;
} catch (e) {
}
| javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/meteor/test.js | meteor/test.js | 'use strict';
Tinytest.add('Moment.is', function (test) {
test.ok(moment.isMoment(moment()), {message: 'simple moment object'});
});
| javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
moment/moment | https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/meteor/package.js | meteor/package.js | // package metadata file for Meteor.js
'use strict';
var packageName = 'momentjs:moment'; // https://atmospherejs.com/momentjs/moment
Package.describe({
name: packageName,
summary: 'Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging',
version: '2.30.1',
git: 'htt... | javascript | MIT | 18aba135ab927ffe7f868ee09276979bed6993a6 | 2026-01-04T14:57:37.850382Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/App.test.js | coding-exercise/src/App.test.js | import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
| javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/index.js | coding-exercise/src/index.js | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want your app to work offline and load f... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/App.js | coding-exercise/src/App.js | import React, { useState } from 'react';
import './App.css';
import HomePage from './components/HomePage';
import NavigationButton from './components/NavigationButton';
import { exercises } from './exercises';
function App() {
const [currentView, setCurrentView] = useState('home');
const renderView = () => {
... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/serviceWorker.js | coding-exercise/src/serviceWorker.js | // This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a p... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/setupTests.js | coding-exercise/src/setupTests.js | // jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect';
| javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/index.js | coding-exercise/src/exercises/index.js | import * as Exercise01 from './exercise-01-state-batching';
import * as Exercise02 from './exercise-02-useeffect-dependencies';
import * as Exercise03 from './exercise-03-useCallback-memoization';
import * as Exercise04 from './exercise-04-custom-hooks';
/**
* Exercise Registry
*
* To add a new exercise:
* 1. Cre... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/__template__/index.js | coding-exercise/src/exercises/__template__/index.js | export { default as Problem } from './Problem';
export { default as Solution } from './Solution';
| javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/__template__/Solution.js | coding-exercise/src/exercises/__template__/Solution.js | import React, { useState } from 'react';
/**
* CODING EXERCISE X: [Exercise Title] - SOLUTION
*
* ANSWER: [Correct option]
*
* EXPLANATION:
*
* 1. [First key point]
* - [Detail]
* - [Detail]
*
* 2. [Second key point]
* - [Detail]
* - [Detail]
*
* 3. [Third key point]
* - [Detail]
*... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/__template__/Problem.js | coding-exercise/src/exercises/__template__/Problem.js | import React, { useState } from 'react';
/**
* CODING EXERCISE X: [Exercise Title]
*
* PROBLEM:
* [Describe the problem here]
*
* Options:
* A) [Option A]
* B) [Option B]
* C) [Option C]
* D) [Option D]
*
* BONUS: [Optional bonus question]
*/
function Problem() {
// Add your state and logic here
c... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-02-useeffect-dependencies/index.js | coding-exercise/src/exercises/exercise-02-useeffect-dependencies/index.js | export { default as Problem } from './Problem';
export { default as Solution } from './Solution';
| javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-02-useeffect-dependencies/Solution.js | coding-exercise/src/exercises/exercise-02-useeffect-dependencies/Solution.js | import React, { useState, useEffect, useRef } from 'react';
/**
* CODING EXERCISE 2: useEffect Dependencies and Infinite Loops - SOLUTION
*
* ANSWER: B) The count increments infinitely causing an infinite loop
*
* EXPLANATION:
*
* 1. OBJECT REFERENCE PROBLEM:
* - setData({ value: count }) creates a NEW o... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-02-useeffect-dependencies/Problem.js | coding-exercise/src/exercises/exercise-02-useeffect-dependencies/Problem.js | import React, { useState, useEffect } from 'react';
/**
* CODING EXERCISE 2: useEffect Dependencies and Infinite Loops
*
* PROBLEM:
* What will happen when this component renders?
*
* Options:
* A) The count increments once to 1 and stops
* B) The count increments infinitely causing an infinite loop
* C) Th... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-01-state-batching/index.js | coding-exercise/src/exercises/exercise-01-state-batching/index.js | export { default as Problem } from './Problem';
export { default as Solution } from './Solution';
| javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-01-state-batching/Solution.js | coding-exercise/src/exercises/exercise-01-state-batching/Solution.js | import React, { useState } from 'react';
/**
* CODING EXERCISE 1: State Batching and Event Handlers - SOLUTION
*
* ANSWER: C) Counter: 1, Alert shows: 0
*
* EXPLANATION:
*
* 1. STATE CLOSURE:
* - When the event handler runs, `counter` is captured with its current value (0)
* - All three setCounter ca... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-01-state-batching/Problem.js | coding-exercise/src/exercises/exercise-01-state-batching/Problem.js | import React, { useState } from 'react';
/**
* CODING EXERCISE 1: State Batching and Event Handlers
*
* PROBLEM:
* What will be the output after clicking the "Increment" button once?
*
* Options:
* A) Counter: 3, Alert shows: 3
* B) Counter: 3, Alert shows: 0
* C) Counter: 1, Alert shows: 0
* D) Counter: 1... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-04-custom-hooks/index.js | coding-exercise/src/exercises/exercise-04-custom-hooks/index.js | export { default as Problem } from './Problem';
export { default as Solution } from './Solution';
| javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-04-custom-hooks/Solution.js | coding-exercise/src/exercises/exercise-04-custom-hooks/Solution.js | import React, { useState, useEffect } from 'react';
/**
* CODING EXERCISE 4: Custom Hooks and Code Reusability - SOLUTION
*
* ANSWER: B) Code duplication - should extract into a custom hook
*
* EXPLANATION:
*
* 1. THE PROBLEM:
* - Both components have identical data fetching logic
* - Duplicate state... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-04-custom-hooks/Problem.js | coding-exercise/src/exercises/exercise-04-custom-hooks/Problem.js | import React, { useState, useEffect } from 'react';
/**
* CODING EXERCISE 4: Custom Hooks and Code Reusability
*
* PROBLEM:
* You have two components that fetch data from different APIs.
* Both components have similar logic for loading, error handling, and data fetching.
*
* Question: What's wrong with this c... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-03-useCallback-memoization/index.js | coding-exercise/src/exercises/exercise-03-useCallback-memoization/index.js | export { default as Problem } from './Problem';
export { default as Solution } from './Solution';
| javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-03-useCallback-memoization/Solution.js | coding-exercise/src/exercises/exercise-03-useCallback-memoization/Solution.js | import React, { useState, useCallback, memo } from 'react';
/**
* CODING EXERCISE 3: useCallback and Unnecessary Re-renders - SOLUTION
*
* ANSWER: B) ChildComponent re-renders every time count changes
*
* EXPLANATION:
*
* 1. FUNCTION REFERENCE PROBLEM:
* - Every time the parent re-renders, handleClick is... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/exercises/exercise-03-useCallback-memoization/Problem.js | coding-exercise/src/exercises/exercise-03-useCallback-memoization/Problem.js | import React, { useState, useCallback } from 'react';
/**
* CODING EXERCISE 3: useCallback and Unnecessary Re-renders
*
* PROBLEM:
* In the code below, the ChildComponent re-renders every time the parent's count changes,
* even though the child only depends on the handleClick function.
*
* Options:
* A) Chil... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/components/HomePage.js | coding-exercise/src/components/HomePage.js | import React from 'react';
import ExerciseCard from './ExerciseCard';
import { exercises } from '../exercises';
function HomePage({ onNavigate }) {
return (
<div style={{ padding: '40px', fontFamily: 'Arial', maxWidth: '800px', margin: '0 auto' }}>
<h1 style={{ color: '#61dafb' }}>React Coding Exercises</h... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/components/NavigationButton.js | coding-exercise/src/components/NavigationButton.js | import React from 'react';
function NavigationButton({ onClick, children, style = {} }) {
return (
<button
onClick={onClick}
style={{
position: 'fixed',
top: '20px',
left: '20px',
padding: '10px 20px',
backgroundColor: '#007bff',
color: 'white',
... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
sudheerj/reactjs-interview-questions | https://github.com/sudheerj/reactjs-interview-questions/blob/aca1e037111b0437dd1c89acb6e85b75c0a74b22/coding-exercise/src/components/ExerciseCard.js | coding-exercise/src/components/ExerciseCard.js | import React from 'react';
const difficultyColors = {
Easy: '#28a745',
Medium: '#ffc107',
Hard: '#dc3545',
};
function ExerciseCard({ exercise, onViewProblem, onViewSolution }) {
return (
<div
style={{
padding: '20px',
marginBottom: '20px',
backgroundColor: '#f8f9fa',
... | javascript | MIT | aca1e037111b0437dd1c89acb6e85b75c0a74b22 | 2026-01-04T14:58:53.175204Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/standalone.js | standalone.js | export * from "./src/standalone.js";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/index.js | index.js | export * from "./src/index.js";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/knip.config.js | knip.config.js | import { isCI } from "ci-info";
/** @import {KnipConfig} from "knip" */
/** @type {KnipConfig} */
const config = {
workspaces: {
".": {
entry: [
// Production plugin entries
"src/plugins/*",
"packages/plugin-oxc/index.js",
"packages/plugin-hermes/index.js",
"script... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/prettier.config.js | prettier.config.js | /**
* @see https://prettier.io/docs/configuration
* @type {import("prettier").Config}
*/
const config = {
overrides: [
{
files: ["**/*.{js,mjs,cjs}"],
options: {
parser: "meriyah",
},
},
{
files: ["bin/prettier.cjs"],
options: {
trailingComma: "none",
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/jest.config.js | jest.config.js | import path from "node:path";
import createEsmUtils from "esm-utils";
import installBrowser from "./tests/config/install-browser.js";
import installPrettier from "./tests/config/install-prettier.js";
const { dirname: PROJECT_ROOT } = createEsmUtils(import.meta);
const isProduction = process.env.NODE_ENV === "productio... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/eslint.config.js | eslint.config.js | import url from "node:url";
import eslintPluginJs from "@eslint/js";
import eslintPluginStylistic from "@stylistic/eslint-plugin";
import eslintPluginTypescriptEslint from "@typescript-eslint/eslint-plugin";
import { isCI } from "ci-info";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginJe... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/generate-changelog.js | scripts/generate-changelog.js | #!/usr/bin/env node
/**
* When you run the script, enter the number and category of the Pull Request at the prompt.
* Get the PR title and author name via the GitHub API and create a file in ./changelog_unreleased
*
* $ node ./scripts/generate-changelog.js
* ✔ Input your Pull Request number: 10961
* ✔ Inpu... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/production-eslint-config.js | scripts/production-eslint-config.js | import assert from "node:assert";
import fs from "node:fs/promises";
import path from "node:path";
import eslintPluginCompat from "eslint-plugin-compat";
import packageBuildConfigs from "./build/packages/index.js";
import { PROJECT_ROOT } from "./utilities/index.js";
const { browserslist: targets } = JSON.parse(
awa... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/generate-flow-estree-type-definition.js | scripts/generate-flow-estree-type-definition.js | import fs from "node:fs/promises";
import url from "node:url";
import { codeFrameColumns } from "@babel/code-frame";
import * as ts from "typescript";
import * as prettier from "../index.js";
const PROJECT_ROOT = new URL("../", import.meta.url);
const FLOW_TYPES = new URL(
"./node_modules/hermes-estree/dist/types.js... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/changelog-for-patch.js | scripts/changelog-for-patch.js | #!/usr/bin/env node
import path from "node:path";
import { parseArgs } from "node:util";
import semver from "semver";
import {
categories,
changelogUnreleasedDirPath,
changelogUnreleasedDirs,
getEntries,
printEntries,
replaceVersions,
} from "./utilities/changelog.js";
const { previousVersion, newVersion ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/check-deps.js | scripts/check-deps.js | #!/usr/bin/env node
import fs from "node:fs/promises";
import styleText from "node-style-text";
const PROJECT_ROOT = new URL("../", import.meta.url);
const ERROR = styleText.bgRed.black(" ERROR ");
const PASS = "✅ All dependency versions are pinned.";
for (const [index, directory] of [
"./",
"./website/",
"./s... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/build-website.js | scripts/build-website.js | #!/usr/bin/env node
import fs from "node:fs/promises";
import path from "node:path";
import url from "node:url";
import esbuild from "esbuild";
import fastGlob from "fast-glob";
import spawn from "nano-spawn";
import serialize from "serialize-javascript";
import {
copyFile,
DIST_DIR,
PROJECT_ROOT,
WEBSITE_DIR,... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/generate-unused-typescript-specifiers.js | scripts/generate-unused-typescript-specifiers.js | import fs from "node:fs/promises";
import esbuild from "esbuild";
import * as importMetaResolve from "import-meta-resolve";
import { outdent } from "outdent";
import * as prettier from "prettier";
import * as typescript from "typescript";
import { modifyTypescriptModule } from "./build/hacks/modify-typescript-module.js... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/clean-git-blame-ignore-revs-file.js | scripts/clean-git-blame-ignore-revs-file.js | #!/usr/bin/env node
/*
Clean up `.git-blame-ignore-revs`
Remove revs without actual file change
*/
import fs from "node:fs/promises";
import spawn from "nano-spawn";
const FILE = new URL("../.git-blame-ignore-revs", import.meta.url);
const content = await fs.readFile(FILE, "utf8");
const lines = content.split("\n"... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/clean-markdown-legacy-spec.js | scripts/clean-markdown-legacy-spec.js | import fs from "node:fs/promises";
import commonmarkTestSuite from "commonmark-test-suite";
const existing = new Set(
Object.values(commonmarkTestSuite).flatMap((release) =>
release.testCases.map(({ markdown }) => markdown.trim()),
),
);
const DIRECTORIES = [
new URL("../tests/format/markdown/spec-legacy/",... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/nodejs-14-test-loader.js | scripts/nodejs-14-test-loader.js | import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import esbuild from "esbuild";
// `@babel/code-frame` and `@babel/highlight` use syntax that is not available in Node.js 14,
// such as `??=`. When bundled into dist/ they are compiled to be compatible with Node.js 14,
// however we... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/generate-schema.js | scripts/generate-schema.js | #!/usr/bin/env node
import { generateSchema } from "./utilities/generate-schema.js";
console.log(await generateSchema());
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/lint-changelog.js | scripts/lint-changelog.js | #!/usr/bin/env node
import assert from "node:assert/strict";
import fs from "node:fs";
import indexToPosition from "index-to-position";
import { outdent } from "outdent";
import remarkParse from "remark-parse";
import unified from "unified";
import { CHANGELOG_CATEGORIES } from "./utilities/changelog-categories.js";
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/generate-builtin-plugins.js | scripts/generate-builtin-plugins.js | import assert from "node:assert/strict";
import fs from "node:fs/promises";
import path from "node:path";
import { isValidIdentifier } from "@babel/types";
import camelcase from "camelcase";
import { outdent } from "outdent";
import { format } from "prettier";
import { toPath } from "url-or-path";
const projectRoot = ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/clean-cspell.js | scripts/clean-cspell.js | #!/usr/bin/env node
import fs from "node:fs/promises";
import spawn from "nano-spawn";
const CSPELL_CONFIG_FILE = new URL("../cspell.json", import.meta.url);
const updateConfig = (config) =>
fs.writeFile(CSPELL_CONFIG_FILE, JSON.stringify(config, undefined, 4) + "\n");
const runSpellcheck = (args, options) =>
spa... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/format-test-lint.js | scripts/format-test-lint.js | #!/usr/bin/env node
// Make sure format test directories contains format test script.
import fs from "node:fs/promises";
import path from "node:path";
import { PROJECT_ROOT } from "./utilities/index.js";
const FORMAT_TEST_DIRECTORY = path.join(PROJECT_ROOT, "tests/format/");
const TEST_SCRIPT_FILE_NAME = "format.tes... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/prepare-test-for-legacy-nodejs.js | scripts/prepare-test-for-legacy-nodejs.js | import fs from "node:fs";
const packageJsonFile = new URL("../package.json", import.meta.url);
const packageJson = JSON.parse(fs.readFileSync(packageJsonFile));
const argv = process.argv.slice(2);
const nodeVersion = Number(argv[1]);
if (argv[0] !== "--node-version" || !Number.isInteger(nodeVersion)) {
throw new E... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/draft-blog-post.js | scripts/draft-blog-post.js | #!/usr/bin/env node
import fs from "node:fs";
import path from "node:path";
import createEsmUtils from "esm-utils";
import fg from "fast-glob";
import semver from "semver";
import {
categories,
changelogUnreleasedDirPath,
changelogUnreleasedDirs,
getEntries,
printEntries,
replaceVersions,
} from "./utiliti... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/utilities.js | scripts/release/utilities.js | import fs from "node:fs";
import path from "node:path";
import readline from "node:readline";
import url from "node:url";
import spawn from "nano-spawn";
import styleText from "node-style-text";
import outdent from "outdent";
import getFormattedDate from "./get-formatted-date.js";
readline.emitKeypressEvents(process.s... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/release.js | scripts/release/release.js | #!/usr/bin/env node
/* This file can't use any dependency since the dependencies may not installed yet */
import { exec } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
const directory = path.dirname(fileURLToPath(import.meta.url));
function runCommand(command) {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/parse-arguments.js | scripts/release/parse-arguments.js | import { parseArgs } from "node:util";
function parseArguments() {
const {
values: {
version,
repo = "git@github.com:prettier/prettier.git",
manual = false,
dry = false,
"skip-dependencies-install": skipDependenciesInstall = false,
next = false,
},
} = parseArgs({
op... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/run.js | scripts/release/run.js | import semver from "semver";
import parseArguments from "./parse-arguments.js";
import * as steps from "./steps/index.js";
import { logPromise, readJson } from "./utilities.js";
const params = parseArguments();
const {
default: { version: previousVersion },
} = await import("prettier/package.json", {
with: { type:... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/get-formatted-date.js | scripts/release/get-formatted-date.js | // TODO: Implement this in `utilities.js` when jest.importActual is landed.
export default function getFormattedDate() {
const date = new Date();
const isoStr = date.toISOString();
const year = isoStr.slice(0, 4);
const month = isoStr.slice(5, 7);
const day = isoStr.slice(8, 10);
return { year, month, day... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/tests/publish-to-npm.test.js | scripts/release/tests/publish-to-npm.test.js | import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { URLSearchParams } from "node:url";
import { getReleaseUrl } from "../steps/show-instructions-after-npm-publish.js";
const RELEASE_URL_BASE = "https://github.com/prettier/prettier/releases/new?";
const getExpectedReleaseUrl = (p... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/tests/version-check.test.js | scripts/release/tests/version-check.test.js | import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { isVersionReleased } from "../steps/wait-for-bot-release.js";
describe("isVersionReleased", () => {
it("returns true for existing version", async () => {
assert.ok(await isVersionReleased("1.0.0"));
});
it("rejects for... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/tests/validate-new-version.test.js | scripts/release/tests/validate-new-version.test.js | import assert from "node:assert/strict";
import { describe, it } from "node:test";
import styleText from "node-style-text";
import validateNewVersion from "../steps/validate-new-version.js";
describe("validate-new-version", () => {
it("throws error for missing version", () => {
assert.throws(
() => {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/choose-version.js | scripts/release/steps/choose-version.js | import enquirer from "enquirer";
import semver from "semver";
const SEMVER_INCREMENTS = ["patch", "minor", "major"];
const CUSTOM_VERSION_VALUE_PLACEHOLDER = "custom-version";
export default async function chooseVersion(params) {
let version = await new enquirer.Select({
name: "version",
message: `Choose a ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/merge-blog-post.js | scripts/release/steps/merge-blog-post.js | import styleText from "node-style-text";
import semver from "semver";
import { runGit, waitForEnter } from "../utilities.js";
export default async function mergeBlogPost({
dry,
repo,
version,
previousVersion,
}) {
if (dry) {
return;
}
if (semver.diff(version, previousVersion) === "patch") {
retu... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/update-changelog.js | scripts/release/steps/update-changelog.js | import fs from "node:fs";
import spawn from "nano-spawn";
import styleText from "node-style-text";
import semver from "semver";
import {
getBlogPostInfo,
getChangelogContent,
logPromise,
runYarn,
waitForEnter,
} from "../utilities.js";
function writeChangelog(params) {
const changelog = fs.readFileSync("CH... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/check-git-status.js | scripts/release/steps/check-git-status.js | import { runGit } from "../utilities.js";
export default async function checkGitStatus({ next }) {
const { stdout: status } = await runGit(["status", "--porcelain"]);
if (status) {
throw new Error(
"Uncommitted local changes. " +
"Please revert or commit all local changes before making a release... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/clean-changelog.js | scripts/release/steps/clean-changelog.js | import fs from "node:fs/promises";
import { fileURLToPath } from "node:url";
import fastGlob from "fast-glob";
import { runGit } from "../utilities.js";
export default async function cleanChangelog({ repo }) {
const changelogUnreleasedDir = fileURLToPath(
new URL("../../../changelog_unreleased", import.meta.url)... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/validate-new-version.js | scripts/release/steps/validate-new-version.js | import styleText from "node-style-text";
import semver from "semver";
export default function validateNewVersion({ version, previousVersion, next }) {
if (!version) {
throw new Error("'--version' is required");
}
if (!semver.valid(version)) {
throw new Error(
`Invalid version '${styleText.red.unde... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/install-dependencies.js | scripts/release/steps/install-dependencies.js | import fs from "node:fs/promises";
import { runGit, runYarn } from "../utilities.js";
const PROJECT_ROOT = new URL("../../../", import.meta.url);
async function installDependenciesInDirectory(directory) {
await fs.rm(new URL("./node_modules/", directory), {
recursive: true,
force: true,
});
await runYar... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/update-dependents-count.js | scripts/release/steps/update-dependents-count.js | import styleText from "node-style-text";
import { fetchText, logPromise, processFile, runGit } from "../utilities.js";
async function getNpmDependentsCount() {
const npmPage = await logPromise(
"Fetching npm dependents count",
fetchText("https://www.npmjs.com/package/prettier"),
);
const dependentsCountN... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/show-instructions-after-npm-publish.js | scripts/release/steps/show-instructions-after-npm-publish.js | import styleText from "node-style-text";
import outdent from "outdent";
import semver from "semver";
import {
getBlogPostInfo,
getChangelogContent,
waitForEnter,
} from "../utilities.js";
const RELEASE_URL_BASE = "https://github.com/prettier/prettier/releases/new?";
export function getReleaseUrl(version, previou... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/index.js | scripts/release/steps/index.js | export { default as bumpPrettier } from "./bump-prettier.js";
export { default as checkGitStatus } from "./check-git-status.js";
export { default as chooseVersion } from "./choose-version.js";
export { default as cleanChangelog } from "./clean-changelog.js";
export { default as generateBundles } from "./generate-bundle... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/bump-prettier.js | scripts/release/steps/bump-prettier.js | import fs from "node:fs";
import semver from "semver";
import {
logPromise,
readJson,
runGit,
runYarn,
writeJson,
} from "../utilities.js";
async function format() {
await runYarn(["fix:prettier"]);
}
// Only add commit to `.git-blame-ignore-revs` when files except `package.json` and `yarn.lock` changed
c... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/generate-bundles.js | scripts/release/steps/generate-bundles.js | import styleText from "node-style-text";
import { logPromise, readJson, runYarn } from "../utilities.js";
export default async function generateBundles({ dry, version, manual }) {
if (!manual) {
return;
}
await logPromise(
"Generating bundles",
runYarn([
"build",
"--package=prettier",
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/publish-to-npm.js | scripts/release/steps/publish-to-npm.js | import enquirer from "enquirer";
import spawn from "nano-spawn";
import { waitForEnter } from "../utilities.js";
export default async function publishToNpm({ dry }) {
console.log(`Ready to publish to NPM${dry ? "(--dry-run)" : ""}`);
await waitForEnter();
const commonArgs = ["publish"];
if (dry) {
common... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/push-to-git.js | scripts/release/steps/push-to-git.js | import { runGit } from "../utilities.js";
export default async function pushToGit({ version, repo }) {
await runGit(["commit", "-am", `Release ${version}`]);
await runGit(["tag", "-a", version, "-m", `Release ${version}`]);
await runGit(["push", "--repo", repo]);
await runGit(["push", "--tags", "--repo", repo]... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/update-version.js | scripts/release/steps/update-version.js | import { processFile, readJson, runYarn, writeJson } from "../utilities.js";
export default async function updateVersion({ version, next }) {
const pkg = await readJson("package.json");
pkg.version = version;
await writeJson("package.json", pkg);
// For pre-release, just update package.json
if (next) {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/wait-for-bot-release.js | scripts/release/steps/wait-for-bot-release.js | import styleText from "node-style-text";
import outdent from "outdent";
import { logPromise, waitForEnter } from "../utilities.js";
export async function isVersionReleased(version) {
const response = await fetch("https://registry.npmjs.org/prettier/");
const result = await response.json();
const versionExists = ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/release/steps/post-publish-steps.js | scripts/release/steps/post-publish-steps.js | import styleText from "node-style-text";
import outdent from "outdent";
import { fetchText, logPromise, writeFile } from "../utilities.js";
const SCHEMA_REPO = "SchemaStore/schemastore";
const SCHEMA_PATH = "src/schemas/json/prettierrc.json";
const RAW_URL = `https://raw.githubusercontent.com/${SCHEMA_REPO}/master/${S... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/tools/bundle-test/index.js | scripts/tools/bundle-test/index.js | import { createRequire } from "node:module";
import path from "node:path";
import url from "node:url";
import webpack from "webpack";
import packageBuildConfigs from "../../build/packages/index.js";
function runWebpack(config) {
return new Promise((resolve, reject) => {
webpack(config, (error, stats) => {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/scripts/tools/eslint-plugin-prettier-internal-rules/flat-ast-path-call.js | scripts/tools/eslint-plugin-prettier-internal-rules/flat-ast-path-call.js | // This rule only work for nested `AstPath#call()` for now
function astPathCallSelector(path) {
const prefix = path ? `${path}.` : "";
return [
`[${prefix}type="CallExpression"]`,
`[${prefix}callee.type="MemberExpression"]`,
`[${prefix}callee.property.type="Identifier"]`,
`[${prefix}callee.property... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.