TypeScript is a general purpose programming language developed by Microsoft Inc. It is based on JavaScript yet more powerful. TypeScript is used for developing large applications and transcompiles to JavaScript.

Popular New Releases in TypeScript

vscode

March 2022 Recovery 2

angular

v14.0.0-next.14

TypeScript

TypeScript 4.7 Beta

ant-design

4.20.0-alpha.1

puppeteer

13.6.0

Popular Libraries in TypeScript

developer-roadmap

by kamranahmedse doticontypescriptdoticon

star image 179452 doticonNOASSERTION

Roadmap to becoming a web developer in 2021

vscode

by microsoft doticontypescriptdoticon

star image 130477 doticonMIT

Visual Studio Code

angular

by angular doticontypescriptdoticon

star image 80840 doticonMIT

The modern web developer’s platform

TypeScript

by microsoft doticontypescriptdoticon

star image 79882 doticonApache-2.0

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

ant-design

by ant-design doticontypescriptdoticon

star image 79578 doticonMIT

An enterprise-class UI design language and React UI library

puppeteer

by puppeteer doticontypescriptdoticon

star image 77484 doticonApache-2.0

Headless Chrome Node.js API

storybook

by storybookjs doticontypescriptdoticon

star image 70458 doticonMIT

📓 The UI component explorer. Develop, document, & test React, Vue, Angular, Web Components, Ember, Svelte & more!

redux

by reduxjs doticontypescriptdoticon

star image 57862 doticonNOASSERTION

Predictable state container for JavaScript apps

svelte

by sveltejs doticontypescriptdoticon

star image 57249 doticonMIT

Cybernetically enhanced web apps

Trending New libraries in TypeScript

vite

by vitejs doticontypescriptdoticon

star image 40832 doticonMIT

Next generation frontend tooling. It's fast!

excalidraw

by excalidraw doticontypescriptdoticon

star image 28761 doticonMIT

Virtual whiteboard for sketching hand-drawn like diagrams

slidev

by slidevjs doticontypescriptdoticon

star image 19954 doticonMIT

Presentation Slides for Developers (Beta)

autocomplete

by withfig doticontypescriptdoticon

star image 16522 doticonMIT

Fig adds autocomplete to your terminal.

backstage

by backstage doticontypescriptdoticon

star image 16116 doticonApache-2.0

Backstage is an open platform for building developer portals

type-challenges

by type-challenges doticontypescriptdoticon

star image 16090 doticonMIT

Collection of TypeScript type challenges with online judge

remix

by remix-run doticontypescriptdoticon

star image 15742 doticonMIT

Build Better Websites. Create modern, resilient user experiences with web fundamentals.

appsmith

by appsmithorg doticontypescriptdoticon

star image 15181 doticonApache-2.0

Low code project to build admin panels, internal tools, and dashboards. Integrates with 15+ databases and any API.

ar-cutpaste

by cyrildiagne doticontypescriptdoticon

star image 14263 doticonMIT

Cut and paste your surroundings using AR

Top Authors in TypeScript

1

microsoft

680 Libraries

star icon444064

2

victor002

360 Libraries

star icon0

3

hofaw2480744

338 Libraries

star icon0

4

Training360-JavaScript

321 Libraries

star icon0

5

casertyth_casertyth

287 Libraries

star icon0

6

dyma-projects

274 Libraries

star icon3

7

raulp00006

257 Libraries

star icon0

8

luis000066

223 Libraries

star icon0

9

aws-samples

213 Libraries

star icon4856

10

vtex-apps

207 Libraries

star icon485

1

680 Libraries

star icon444064

2

360 Libraries

star icon0

3

338 Libraries

star icon0

4

321 Libraries

star icon0

5

287 Libraries

star icon0

6

274 Libraries

star icon3

7

257 Libraries

star icon0

8

223 Libraries

star icon0

9

213 Libraries

star icon4856

10

207 Libraries

star icon485

Trending Kits in TypeScript


The chess game is one of the most popular games of all time.The object of the game is to checkmate the opponent's king. This kit includes a full chess engine, a GUI engine, and an AI engine. The AI engine utilizes the minimax and alpha-beta pruning algorithms.

Development Environment

VSCode is used for development and debugging. VSCode is used to get a typical experience of IDE for developers.

Gaming Libraries

Pygame helps in providing computer graphics and audio libraries.

Troubleshooting

  1. While running batch file, if you encounter Windows protection alert, select More info --> Run anyway.
  2. During kit installer, if you encounter Windows security alert, click Allow.

Support

f you need help to use this kit, you can email us at kandi.support@openweaver.com or direct message us on Twitter Message @OpenWeaverInc.

kandi 1-Click Install

A color picker is another application of react that enables the users to pick colors from a palette or a color wheel. In online applications, color pickers are frequently used for tasks like choosing a text color, a background color, or a color for a graphical element. React color picker components are provided by several libraries, including react-color and react-color-picker. 

  • react-color-picker: This library provides components that enable the users to include a color- choosing interface in their application. 
  • react-color: A wide range of color picker components, including SketchPicker, ChromePicker, and HuePicker, are included in this library. 


react-color is a more comprehensive library that includes a variety of color picker components with different styles unlike react-color-picker, which is a much simpler library, including a single-color picker component, and customization options are provided by props. There are several more props available for modifying the default color, the format of the selected color, and the layout of the color picker, among other aspects of the ColorPicker component's look and performance. 


For more information about customizing color picker in React, refer to the code given below 

Fig : Preview of the output that you will get on running this code from your IDE.

Code

In this solution we're using React and Styled-components library.

Instructions

Follow the steps carefully to get the output easily.

  1. Install the Node.js and React on your IDE(preferable Visual Studio Code).
  2. Create React Application using npx create-react-app foldername.
  3. cd foldername.
  4. Install npm i styled-components.
  5. Open the folder in IDE.
  6. Copy the code using "copy" button above and paste it in app.js file(remove the earlier code from app.js) and refer demo for styles.css file.
  7. Open the terminal from IDE.
  8. npm start to run the file.


You can also refer this url 'DEMO' for getting the above output.

I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.


I found this code snippet by searching for 'create color picker in react' in kandi. You can try any such use case!

Environment Tested

I tested this solution in the following versions. Be mindful of changes when working with other versions.

  1. The solution is created in Visual Studio Code 1.73.1.
  2. The solution is tested on node v18.12.1 and npm v8.19.2.
  3. React version-18.2.0.
  4. Styled-components version-6.0.0.


Using this solution, we are able to customize color picker in React with simple steps. This process also facilities an easy way to use, hassle-free method to create a hands-on working version of code which would help us to customize color picker in React.

Dependent Library

You can also search for any dependent libraries on kandi like 'react' and 'styled-components'.

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.


ChatGPT is transforming all fields, including application development. You can easily add ChatGPT to your applications to provide additional intelligence.


Here are some cool open source libraries that you can leverage to add ChatGPT capabilities in your applications.


Start with Andrej Karpathy’s NanoGPT to get a feel for how GPT works at a smaller scale, even in your laptop.


ChatGPT Prompts is a great repo to help you leverage ChatGPT personas such as a translator, interviewer, JavaScript console, UI developer, IT architect, Excel sheet, stand-up comedian, philosopher, plagiarism checker, doctor, financial analyst, and many more.

If you'd like to use ChatGPT on your desktop try ChatGPT by lencx.


Up your chat game with ChatGPT apps for WhatApp, Telegram and Discord.


If you would like to use ChatGPT to compare with Google results from your browser, or integrate ChatGPT into your IDE or a general-purpose API to integrate with any other application like Telegram and others to create your custom ChatGPT integrations, below are useful repositories. Try them to build and get familiar with ChatGPT use cases.


JavaScript automation libraries help you to automate actions in your browsers. These libraries are very useful for testing web applications. We can run JavaScript automation using any of the Selenium drivers like ChromeDriver, GeckoDriver, InternetExplorerDriver, etc. One reason for the popularity of JavaScript-based web application frameworks is that most web applications have JavaScript components and it's going to be easier to automate such web applications with JavaScript. Developers tend to use some of the following open source libraries: Detox - tests your mobile app while it’s running in a real device/simulator, interacting with it just like a real user; Shipit - Shipit is an automation engine and a deployment tool. Shipit provides a good alternative to Capistrano or other build tools. It is easy to deploy or automate simple tasks on your remote servers. The entire list of Javascript automation open source libraries is provided below.



ChatGPT is a computer program that can talk like humans. It uses deep learning to generate natural language responses to text-based inputs. It is based on the transformer architecture and has been trained on a massive amount of text data to produce human-like responses to a wide range of queries and conversation topics.

Knowledge Resources

Kit Solution Source

Support

If you need help using this kit, you may reach us at the OpenWeaver Community.

kandi 1-Click Install


A fun little single-player video puzzle game where the player slides numbered pieces around a board and combines numbers to create twice as large numbers.


The popular 2048 Game was originally created in the terminal, but many implementations have been in other languages. The objective of this project is to implement the game in Node.js.


This is a very simple 2048 game built with node JS, VSCode, and HTML. This game is designed to be easy to use and modify.


kandi kit provides you with a fully deployable Interactive 2048 Game in Node.js. The source code is included so that you can customize it for your requirement.

Troubleshooting

  1. While running batch file, if you encounter Windows protection alert, select More info --> Run anyway
  2. During kit installer, if you encounter Windows security alert, click Allow

For a detailed tutorial on installing & executing the solution as well as learning resources including training & certification opportunities, please visit the OpenWeaver Community

Development Environment

Visual Studio Code is a source-code editor made by Microsoft for Windows, Linux, and macOS. Features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git.

Runtime Environment

Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser.

Support

If you need help using this kit, you may reach us at the OpenWeaver Community.

kandi 1-Click Install

DESCRIPTION:


Language Translation with T5 Transformer


The Language Translation endeavor involves a natural language processing challenge focused on utilizing the T5 Transformer model to achieve text translation between different languages. Developed by Google Research, T5 (Text-to-Text Transfer Transformer) is a highly adaptable model that proves valuable across a range of text-based tasks, including language translation.


To accomplish this project, the Hugging Face's transformers library is harnessed, offering pre-trained transformer models, tokenizers, and utilities essential for seamless natural language processing tasks. Within this particular implementation, the T5 model takes center stage, demonstrating its prowess in the art of translation.

DEPENDEND LIBRARIES USED:


Install transformers using pip:


transformers: Developed by Hugging Face, this library offers pre-trained models designed for Natural Language Processing tasks, such as translation. It also comes equipped with tokenizers and utilities to facilitate seamless interaction with these models.

Solution Screenshot:

We can change the font color based on the background color in react by few different ways: 

  • We can use a library that offers practical functions, including color contrast and brightness, to choose the best font color based on the background color. 
  • We may manually determine the contrast ratio between the background color and the text’s color. If the contrast ratio is below a certain threshold, you can choose a different font color to improve the contrast and readability of the text. This can be done by using a library ‘contrast.js.’ 
  • contrast.js: This is a library that helps in measuring the contrast between two colors. The contrast ratio gauges how simple it is to see text against a specific background color. 
  • We can use CSS ‘color’ function. 
  • color: This function allows you to use operations like lightening, darkening, and mixing to provide a color value that is generated from one or more other colors. 


For more information about changing font color based on the background color in React, refer to the code given below 

Fig : Preview of the output that you will get on running this code from your IDE.

Code

In this solution we're using React and styled-component library.

Instructions

Follow the steps carefully to get the output easily.

  1. Install the Node.js and React on your IDE(preferable Visual Studio Code).
  2. Create React Application using npx create-react-app foldername.
  3. cd foldername.
  4. Open the folder in IDE.
  5. Copy the code using "copy" button above and paste it in index.js file(remove the earlier code from index.js) and refer demo for additional one file called style.js file.
  6. Add export default statement at end of the code(like 'export default App;').
  7. Open the terminal from IDE.
  8. npm start to run the file.


You can also refer this url 'DEMO' for getting the above output.

I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.


I found this code snippet by searching for 'change the font color based on background color in React' in kandi. You can try any such use case!

Environment Tested

I tested this solution in the following versions. Be mindful of changes when working with other versions.

  1. The solution is created in Visual Studio Code 1.73.1.
  2. The solution is tested on node v18.12.1 and npm v8.19.2.
  3. React version-18.2.0.
  4. Styled-components version-6.0.0.


Using this solution, we are able to change the font color based on background color in React with simple steps. This process also facilities an easy way to use, hassle-free method to create a hands-on working version of code which would help us to change the font color based on background color in React.

Dependent Library

You can also search for any dependent libraries on kandi like 'react' and 'styled-component'.

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.


Here are some famous Angular Menu Libraries. Some of the use cases of Angular Menu Libraries include Creating a navigation menu with a hierarchical structure, adding animation effects to menus, building a custom menu, and creating a responsive menu.  


Angular menu libraries refer to a collection of libraries or components that allow users to create menus or navigation elements in their Angular applications. These libraries typically provide UI components that will enable users to easily build and customize menus and navigation menus with minimal coding.  

Let us look at the libraries in detail below. 

primeng 

  • Intuitive and user-friendly interface that makes it easier to use and develop applications. 
  • Built with performance in mind, and is one of the fastest-growing UI libraries.   
  • Built-in responsive design support and a wide range of themes that can be easily customized. 

ngx-contextmenu 

  • Designed to be responsive so that it will look great on any device.   
  • Lightweight and fast, it won't slow down your website or application.   
  • Is compatible with most modern browsers to provide a consistent experience across all devices. 

contextr 

  • Contextr provides a simple API for creating custom menus that can be used for any application.  
  • Contextr is optimized for performance, ensuring that your menus are always snappy and responsive. 
  •  Contextr has a wide range of customization options, allowing you to adjust the look and feel of your menus to match your app’s design.  

fab-menu 

  • Easy to configure and customize. 
  • Fully compatible with Angular 6 and higher.  
  • Supports advanced features such as nested menus and auto-closing submenus, making navigation fast and intuitive. 

ngx-bootstrap 

  • Offers a wide range of custom components and widgets.  
  • Menu options are highly customizable, allowing developers to create unique designs.  
  • Powerful API allows developers to integrate 3rd party components into their menus easily. 

ngx-charts 

  • Highly flexible and can be used to create different types of charts. 
  • Offers excellent performance, with smooth animation and fast loading times.  
  • Supported by a vibrant community of developers who can help and advice when needed. 

handsontable 

  • Highly customizable, allowing developers to integrate easily with their existing applications.   
  • Built on the popular React library.  
  • Optimized for mobile devices. 

ngx-admin 

  • Comes with a powerful and customizable themeing system. 
  • Features a simple and intuitive navigation system. 
  • Easily create responsive and mobile-friendly applications.  

angular-ngrx-material-starter 

  • Provides a wide range of components, such as menus, buttons, and forms. 
  • Provides robust features such as accessibility, internationalization, and animations.  
  • Uses ngrx to combine the state management of Angular with the power of the Redux pattern. 

ngx-select-dropdown 

  • Customizable dropdown template with complete control over styling and classes. 
  • Option to set the maximum selection limit. 
  • Option to disable the select dropdown option. 

Here are some famous React Animation Bot Libraries. Some of the use cases of React Animation Libraries include Creating custom page transitions, animating user interface elements, animating data visualisations, Animating complex user interfaces. 


React animation libraries are JavaScript libraries that provide a set of tools to animate components in a React application. These libraries make it easy to animate various components such as buttons, dropdowns, modals, and other user interface elements. They provide powerful APIs that allow developers to create complex animations with minimal code. 


Let us look at the libraries in detail below. 

react-spring 

  • Utilizes physical equations and damping functions to create realistic and natural animations. 
  • Integrates with any other animation library. 
  • Highly optimized for performance, making it a great choice for complex animations. 

react-native-reanimated 

  • Support for both imperative and declarative APIs. 
  • Support for interpolation and value transformations. 
  • Ability to use native platform-specific animations (e.g., spring animations on iOS). 

animated 

  • Provides a comprehensive and flexible API for declarative and imperative animation control. 
  • Only library to offer React Native support. 
  • Allows developers to animate components directly from the React Native bridge.

react-anime 

  • Modular structure allows developers to create custom animations from individual components. 
  • Allows developers to create smooth transitions between different states of their animation. 
  • Offers unique easing functions to create a variety of animation styles. 

react-animation 

  • Supports both CSS and JavaScript animations, making it easy to customize and animate components. 
  • Offers a wide variety of animations such as sliding, fading, and scaling. 
  • Allows developers to chain multiple animations together to create complex sequences. 

moti 

  • Advanced features such as timeline-based animation sequencing. 
  • Supports both native and JavaScript-based animations. 
  • Includes an extensive library of pre-built animations. 

Resonance 

  • Offers a robust set of tools to customize and manage animations. 
  • Designed to be performant, meaning that animations run smoothly on all devices. 
  • Provides an easy way to create complex animations, along with a variety of interpolation methods and easing functions. 

react-animation-comparison 

  • Provides a comprehensive suite of tools and features. 
  • Powerful animation library and an intuitive GUI. 
  • Has a built-in timeline and animation editor. 

renature 

  • Lightweight library that is designed to make animations easy to implement. 
  • It offers a wide range of animation options. 
  • Provides an animation editor that allows users to generate animations quickly and easily. 

Lottie-react 

  • Completely open-source, allowing developers to customize and extend the library as they see fit. 
  • Extremely lightweight and fast-loading. 
  • Declarative API for easily adding complex animations to React components. 

Here are some of the famous React PDF Viewer Libraries. React PDF Viewer Libraries can be used in Education, Business, Healthcare, Legal, and Government for various purposes. 


React PDF viewer libraries allow developers to display PDF files within a React application. These libraries provide features such as page selection, links, bookmarks, search, annotations, and support for various document formats. 


Let us have a look at some React PDF viewer libraries in detail. 

pdf.js 

  • Does not rely on any third-party libraries or plugins. 
  • Supports text search and navigation, text selection, text rotation, and more. 
  • Supports PDF annotations, including highlighting, drawing, and note taking. 

react-pdf 

  • Built using a lightweight virtual DOM and aims to provide fast rendering performance. 
  • Support for multiple languages. 
  • Supports the ability to add annotations. 

react-pdf-viewer 

  • Has features like text selection, page navigation, full-text search, and thumbnail previews. 
  • Supports many file formats, such as PDF, EPUB, PPTX, and more. 
  • Has a fully customizable toolbar with buttons for zooming, printing, downloading, and more. 

react-pdf-highlighter 

  • Support for undo/redo functionality for annotations and comments. 
  • Ability to export annotations and comments as text. 
  • Support for multiple selection modes, including text, area, and paragraph selections.

react-pdf-js 

  • Enhanced security. 
  • High-quality rendering. 
  • Cross-platform support. 

reactjs-pdf-reader 

  • Allows users to jump directly to a page from a table of contents. 
  • Features thumbnail view of pages and supports page navigation. 
  • Allows users to add bookmarks and annotations to a PDF. 

react-pdf-render 

  • Has an easy-to-use interface, allowing users to quickly and easily view PDF documents. 
  • Allows interactive features like page navigation, text search, and page zooming. 
  • Provides fast loading times and smooth page transitions. 

FAQ:

1. Is it possible to use Create React App to create a new PDF document?  

Create React App (CRA) is primarily designed for creating web applications using React. Although it's not designed to make PDFs, you can still use it to build a web tool. This tool can generate PDFs or make a form that collects and turns data into a PDF.


Here is how you might approach it:  

  1. Collect Data in a Form: Create a React component using the Create React App. It allows users to input the necessary data for your PDF document. It could be text, images, or any other relevant information.  
  2. Generate PDF Content: Use a third-party library to generate the content for your PDF.  
  3. Display or Download PDF: Once you generate the PDF, you can offer users the option to display or download it. You can use standard React components and HTML elements for this purpose.  

  

2. What is the Document component, and how does it work when using React-PDF?  

The 'Document' component is important for displaying PDF documents in React apps. It allows you to define the structure of the PDF document you want to display. It includes its pages and content. It stores the PDF document and helps organize and display the contents.  


Here is how the 'document' component works when using 'react-pdf':  

  • Installation and import:  First, you should install the 'react-pdf' library in your project. You can do this using a package manager like yarn or npm. Next, import the required components from the library in your React component.  
  • Usage of the 'Document' component:  You use the 'Document' component to define the structure of the PDF document. It accepts a 'file' prop which specifies the PDF URL you want to render. You can also use 'onLoadSuccess' and 'onLoadError' to handle loading events.  
  • Using 'Page' and other components:  Inside the 'Document' component, you define individual pages using the 'Page' component. Each 'page' component displays the content that should be on that page. You can include various elements within a 'Page' like 'Images or 'Text.'  
  • Rendering the PDF:  Finally, you can render the 'PDFViewer' component within your application. The 'react-pdf' library will display the PDF document according to your defined structure.  


PDF.js makes it easier to display PDFs in browsers with its 'Document,' 'Page,' and other parts. They offer a convenient way to work with PDF documents. You can make PDF views that are dynamic and interactive in your React apps.  

  

3. Can any other related React components use the Document component?  

The 'react-pdf' library offers React components that work with the 'Document' component. These components help you create advanced PDF views in your React app. These components allow you to add various types of content to your PDF documents.


Here are some of the key components:  

  • 'Page' Component:  It represents an individual page within the PDF document. You can use it to organize and structure the content of each page.  
  • 'Text' Component:  It allows you to add text content to your PDF. You can customize font sizes, alignment, color, and styles.  
  • 'Link' Component:  It allows you to create hyperlinks within your PDF document. These links can navigate to other pages within the same document or external URLs.  
  • 'Image' Component:  It will embed images within your PDF document. You can specify the source URL, dimensions, and other properties.  
  • 'Canvas' Component:  It lets you draw custom content directly onto the PDF page, like shapes and graphics.  
  • 'Layer' Component:  It allows you to create layers within your PDF document. You can use layers to show or hide specific content based on user interactions.  
  • 'Outline' Component:  It represents an outline or table of contents for your PDF document. It allows users to navigate to specific sections of the document.  
  • 'Viewer' Component:  It wraps up the 'Document' component. You can use it to control how the PDF viewer looks and works.  
  • 'Note' Component:  It enables you to add annotations or notes to your PDF pages. These notes can be interactive and provide additional information.  
  • 'Font' Component:  It provides the option to use custom fonts in your PDF document. It allows you to maintain consistent typography with your application's design.  

  

4. Where will you find its output folder after creating a document file?  

The PDF isn't saved to your computer when you use the 'react-pdf' library in a React app. Instead, the browser shows the PDF content within the React app. The application generates the PDF dynamically. It is not saved to a file on the server or the client's local machine by default.  


Here is how it works:  

  • Dynamic Rendering:   If you use the 'react-pdf' library, the PDF document becomes a group of React components. It represents the document's structure and content.  
  • No Physical Output:  The PDF appears in the browser without making a physical file. The application's JavaScript and the browser's rendering engine control the PDF content.  
  • Browser Display:  A viewer inside the user's browser shows the PDF content. Users can view the PDF document without downloading or using external software.  

  

5. When should I use jsPdf or pdfMake instead of just React-PDF?  

Both 'react-pdf' and external libraries like 'pdfMake' and 'jsPDF' serve different purposes. You can use it in different scenarios based on your requirements.


Here is when you might consider using an external library in addition to or instead of 'react-pdf':  

  • Complex PDF Generation:  Suppose you want to make custom PDFs with unique designs and interactive features. You can use graphs, tables, and charts for the features. If you want, you can use external libraries like 'jsPDF' or 'pdfMake.' These libraries offer fine-grained control over PDF content creation and layout.  
  • Server-Side Generation:   An external library might be preferable if you need to generate PDFs on the server side. You can create PDFs in various locations, such as web browsers and servers. You can do this by using libraries like jsPDF and pdfMake.  
  • Client-Side Interactivity:   If you need to add interactive elements to a PDF, such as forms or digital signatures, react-pdf won't work. It would help if you considered using a library like jsPDF or pdfMake.  
  • Custom Layouts and Components:   External libraries often provide better support for custom layouts and components. If you want more design choices for your PDF with react-pdf, you can use another library to customize it.  
  • Existing Integration:   If you already use a library like jsPDF or pdfMake, it's wise to keep using it for PDFs.  
  • Performance Considerations:   One library may perform better than another library, depending on how you use it. When choosing a library, compare how fast it renders and how much memory it uses. Find one that fits your needs.  
  • Community and Documentation:   Libraries such as jsPDF and pdfMake have been around for a long time. They have a large community and well-established documentation. If the features of an external library better match your needs, it's a good reason to choose it.  


To summarize, react-pdf is good for displaying PDF content in a React app. You can create PDFs with interactive features using libraries like jsPDF and pdfMake. They provide more flexibility and customization options. Think about what your project needs and the abilities of each library before you decide.

An Angular grid library is a collection of UI components. It is designed for displaying, manipulating, and organizing data in a tabular format. These libraries provide various features and functionalities that enhance data-driven web applications. Angular grid libraries are essential tools for creating interactive and data-rich web applications. They offer comprehensive components tailored for displaying data in a tabular format. These libraries simplify organizing and presenting data in a user-friendly manner.  

 

Angular grid libraries support various data types. It includes simple ones like strings and numbers and complex structures. This flexibility helps handle diverse data scenarios and accommodate different business requirements. Data in an angular grid library can be accessed using querying and mutations. These libraries provide APIs and data-binding capabilities. It enables developers to retrieve and update data efficiently. This ensures seamless communication between the grid and the underlying data source.  

 

Angular grid libraries come with an extensive feature set. They include built-in functionalities. It simplifies data exploration and enhances user experience. These libraries support grouping, aggregation, and virtual scrolling for managing complex datasets. To maximize the benefits of this library, developers can leverage its customization options. Creating custom filters and sorting methods allows for tailored data manipulation and presentation. These customization techniques help meet specific business requirements. It provides a more personalized user experience.  

 

When structuring an angular grid library, you should follow a modular approach. Breaking the library into reusable components promotes code reusability, maintainability, and scalability. Additionally, designing a well-organized interface with intuitive APIs ensures ease of use.  

 

This library offers simplified data management, enhanced user experience, and increased productivity. Developers can create robust and efficient data-driven applications by utilizing the library's features. These libraries stand out due to their extensive API support with major frameworks. These libraries excel in handling large datasets. It provides seamless integration with other UI components. It offers an exceptional performance for rendering and scrolling. With their comprehensive capabilities, these are used in modern applications and data-intensive projects.  

ag-Grid:  

  • It helps in displaying and manipulating large sets of data efficiently.  
  • It supports various features like sorting, filtering, grouping, and pagination.  
  • It offers flexible customization options for cell rendering and styling.  
  • It provides advanced functionality like row selection, editing, and virtual scrolling. 

primeng: 

  • It helps in creating responsive and interactive data grids. 
  • It supports various built-in themes and customization options. 
  • It provides features like filtering, sorting, and pagination. 
  • It offers additional components like tree grid, frozen columns, and context menu. 

ng-zorro-antd: 

  • It helps in creating elegant and user-friendly data grids. 
  • It supports features like sorting, filtering, and pagination. 
  • It provides various built-in themes and customization options. 
  • It offers additional components like tree table and inline editing. 

ngx-datatable: 

  • It helps in creating fast and flexible data tables. 
  • It supports features like sorting, filtering, and pagination. 
  • It provides support for row selection and expansion. 
  • It offers customizable templates for cell rendering and styling. 

md-data-table: 

  • It helps in creating visually appealing and responsive data tables. 
  • It supports features like sorting, filtering, and pagination. 
  • It integrates seamlessly with other Angular Material components. 
  • It provides various styling and customization options. 

Smart-Table: 

  • It helps in creating dynamic and interactive data tables. 
  • It supports features like sorting, filtering, and pagination. 
  • It provides various built-in templates and customization options. 
  • It offers seamless integration with other Angular components. 

DevExtreme: 

  • It helps in building feature-rich and high-performance data grids.  
  • It supports various advanced features like master-detail views and summary rows.  
  • It provides extensive API and customization options.  
  • It offers built-in support for internationalization and accessibility. 

FAQ 

1. What is the Ignite UI Angular Data Grid, and how does it differ from other grid components?  

The Ignite UI Angular Data Grid is a powerful grid component for applications. It offers various features, including advanced data manipulation, sorting, filtering, and paging. Its comprehensive set of UI controls helps it a lot. Also, its seamless integration with Angular and extensive customization options. It provides a rich user experience and simplifies complex data management tasks.  

 

2. When creating a grid component, how do I start with Kendo UI for Angular?  

To get started with Kendo UI for Angular and create a grid component, you can follow these steps:  

a. Install the necessary dependencies using npm or yarn.  

b. Import the required modules from the Kendo UI for the Angular library.  

c. Set up your component's HTML template and define the necessary grid markup.  

d. Configure the grid by providing data, defining columns, and specifying desired features.  

e. Customize the grid's appearance and behavior using the available configuration options and API.  

f. Run your Angular application to see the Kendo UI Grid in action. You can bind it to data, perform interactions, and utilize its various features.  

 

3. What features are available in the Scrollable grid component?  

The Scrollable grid component offers the following features:  

Scrollable sections:  

It allows scrollable content within specified grid sections. It includes the header, footer, or body.  

Row and column virtualization:  

This feature improves performance by rendering only the visible rows and columns. It does so while loading additional content as the user scrolls.  

Full Excel Keyboard Navigation capability:  

Users can navigate through the grid using keyboard shortcuts similar to Excel. It enhances accessibility and user experience.  

Rich UI components:  

The Scrollable grid component integrates with dropdowns, checkboxes, and buttons. It provides a cohesive and consistent user interface.  

 

4. How can web applications benefit from using Ignite UI Angular Data Grid?  

Web applications can benefit from using Ignite UI Angular Data Grid in several ways:  

Simplified development:  

The widgets library provides pre-built and ready-to-use components, reducing development time and effort.  

Consistent UI:  

Widget libraries offer a set of cohesive and well-designed UI components. It ensures a consistent look and feel across the application.  

Enhanced functionality:  

Widget libraries often include advanced features that go beyond basic HTML elements. It enables developers to create more interactive and feature-rich web applications.  

Improved user experience:  

With widget libraries, developers can provide a more intuitive and user-friendly interface. It enhances the user experience of the application.  

 

5. Is DevExtreme Data Grid suitable for modern data-centric frameworks like AngularJS?  

Yes, DevExtreme Data Grid is suitable for modern data-centric frameworks like AngularJS. DevExtreme is a comprehensive component suite that supports multiple frameworks, including AngularJS. This offers data & pop-up data editing, row virtualization, validation, and column filtering. It provides a mature data grid solution for building data-driven web applications.  

 

6. What advantages does JavaScript DataGrid offer over traditional HTML tables for displaying data?  

JavaScript DataGrid offers several advantages over traditional HTML tables for displaying data:  

Feature set:  

JavaScript DataGrid provides a rich feature set. It includes data editing, sorting, filtering, pagination, and advanced data visualization options.  

Performance:  

JavaScript DataGrid is designed to handle large data sets efficiently. It supports features like row and column virtualization. It ensures optimal rendering performance even with a significant amount of data.  

Customization:  

JavaScript DataGrid allows for extensive customization through cell templates and API customization options. It tailors the appearance and behavior of the grid to meet your requirements.  

Rich API:  

JavaScript DataGrid offers a comprehensive API. It allows developers to interact with and manipulate the data grid easily. This API programmatically enables actions such as sorting, filtering, and data manipulation. 

WYSIWYG abbreviates as What You See Is What You Get. A WYSIWYG is an editor library. It enables designers and developers to create attractive user interfaces for websites. It allows them to create content and design elements. We can do it in a what-you-see-is-what-you-get manner rather than using code. This library includes features like the ability to select colors and font types. It also includes features like sizes, drag-and-drop functionality, and image-editing tools. It can further enhance the user experience. Additionally, WYSIWYG editors make WYSIWYG-enabled websites easier to manage. It can help develop UI components.  

Different types of wysiwyg editors are available:  

  • Medium: A free drag-and-drop WYSIWYG editor. It works with images, videos, and other media.  
  • Adobe Dreamweaver: An advanced, subscription-based web development application with solid visual tools.  
  • Aloha Editor: An open-source JavaScript-based WYSIWYG editor emphasizing web standards and accessibility.  
  • TinyMCE: A feature-rich WYSIWYG editor that we can customize and integrate with CMS.  
  • CKEditor: Another powerful WYSIWYG editor. We can customize and integrate it into existing web applications.  
  • Froala: A modern WYSIWYG editor with excellent support for mobile devices. It offers various features to boost productivity.  
  • Quill: A powerful, community-driven WYSIWYG editor with a rich API and modular architecture.  

Different features available in wysiwyg editors include: 

  • Text formatting like style, size, font type, bold, italic, underline, bullets, and numbering. 
  • Inserting images, tables, and links. 
  • Pre-designed templates and layouts. 
  • Graphic design tools like freehand drawing, text boxes, shapes & symbols. 
  • Drag and drop user interface. 
  • Advanced spell check and grammar checking, spell-checker, and many undo/redo options. 
  • Ability to copy-paste from different sources. 
  • Research and reference materials, Thesaurus, and dictionary lookup. 
  • Programmable macros for repetitive tasks. 
  • Options for web page publishing or embedding in other documents.  
  • Concerns about copyrights, permissions, and preservations. 
  • Built-in media players to display audio and video content. 
  • Search and replace functions. 
  • Options for collaboration and real-time editing. 
  • Template libraries, source code, and development support. 

 

To find the best wysiwyg editor, Research user reviews and evaluate their feedback. Most user reviews are honest and will reflect the pros and cons of certain WYSIWYG editors. Consider what features are important to have. Ensure the WYSIWYG editor has the required features to preview in different browsers. See if the editor has a trial or demo mode. This might be simple: a free version that you can download or a time-limited trial of the full version. You can use this to get an in-depth experience of the editor's work before committing to buy. Once you've narrowed down your choices, evaluate the interface and how intuitive it is. Finding an editor that is powerful and easy to use and understand is vital. Consider the price. Editors have hidden fees or restrictions, so read the user agreement before committing.  

 

WYSIWYG Editors help with content creation for websites or documents. They can speed up the design process. It allows the user to create a professional-looking document or website. WYSIWYG editors help create comprehensive and detailed documentation. They allow the user to see the final product and edit it to fit their needs. We can accomplish this by providing a visual editor with familiar elements. The elements like a toolbar, text formatting options, and other editing options. The benefits of the WYSIWYG editor are that it eliminates coding associated with HTML. This makes it easier to create and design documents without skill in coding. Additionally, WYSIWYG editors make the content easier to manage. It allows the user to make modifications and control the output.  

Conclusion:  

WYSIWYG editors provide a simple solution for creating content for websites and blogs. They offer a great user experience. It will allow users to format text, add pictures, and create other multimedia elements. WYSIWYG editors can also help reduce mistakes, saving time and money. WYSIWYG editors come in several different forms. The most popular type is the browser-based WYSIWYG editor, which we can use within a web browser. This type of editor can create HTML pages. It often comes with various built-in templates and tools that we can use for producing pages. When using a WYSIWYG editor, ensuring the content is accurate and easy to read is important. Users should check formatting, images, and links to ensure they are working. It's also important to keep the page design.  

primeng  

  • Easy to integrate with backend APIs.  
  • Allows developers to build applications for both mobile and desktop environments.  
  • Uses several techniques to enhance the loading and rendering of webpages.  

ngx-quill  

  • Enhanced security features such as sanitization and encryption of content.  
  • Modular architecture and customizability.  
  • Support for optimization and internationalization of content.  

angular-froala-wysiwyg  

  • Offers built-in support for media embeds, including YouTube, Instagram, and Vine.  
  • Includes an API to extend functionality and the library to fit specific needs.  
  • Has a wide range of supported plugins and languages for maximum customizability.  

ng2-ckeditor  

  • Powerful real-time collaboration capabilities.  
  • Offers unlimited customization and extensibility with the ability to create custom plugins.  
  • We can use adaptable Angular directives with frameworks like React, Vue, and Angular.  

angular-medium-editor  

  • Support for keyboard navigation, screen reader compatibility, and language selection.  
  • The library doesn't need developers to install any extra libraries or frameworks.  
  • An easy-to-use drag-and-drop interface. It allows users to configure the editor and adapt it to their needs.  

tinymce-angular  

  • We can edit inline, enabling content on the page without opening a dialog box.  
  • Link insertion with support for external URLs and anchors.  
  • Support for tables. We can present complex content to make it easier to navigate. 

ngx-inline-editor  

  • Image resizing functionality within the WYSIWYG editor window.  
  • An auto-saving feature that ensures your content is never lost.  
  • Support for Markdown syntax so you can use special formatting. 

angular-markdown-editor  

  • Ability to switch between a live editor mode and a markdown mode for previews.  
  • Ability to extend functionality with custom plugins and directives.  
  • Many editor shortcuts make it easier to format and navigate content.  

FAQ 

What is a simple native WYSIWYG editor component for Angular applications?  

A popular WYSIWYG editor component for Angular applications is the TinyMCE Editor. It provides a customizable interface with easy AJAX, HTML 5, and jQuery integration. It also includes text formatting, image uploads and is cross-browser compatible.  

 

How does the Angular Rich Text Editor work?  

The Angular Rich Text Editor is a lightweight, open-source WYSIWYG editor. It can quickly integrate into any website or web application. It provides featured, standards-compliant features for creating and managing rich content. It offers features like text, images, links, and embedded media. It includes various customization options. It allows developers to tailor the editor's interface to match their site style. The Angular Rich Text Editor supports both inline and element styling. It is compatible with most popular browsers.  

 

What are the advantages of using applications with a WYSIWYG editor library?  

  • Angular provides a powerful framework. It helps in managing data and the components of a web application.  
  • Due to its platform-agnostic design, Angular can provide a smoother experience.  
  • Angular applications are more secure than traditional web applications. It is because of the TypeScript, dependency injection, and modularized design.  
  • A WYSIWYG editor integration can help improve the user experience within your application.  
  • Angular applications can be more performant than other frameworks. It is because they use an asynchronous, single-threaded approach to rendering content.  

 

Can we combine a code editor with an Angular WYSIWYG editor library?  

Yes, it is possible to use a code editor in combination with an Angular WYSIWYG editor library. There are libraries available like ngx-content-editor, Angular CKEditor, Angular Monaco Editor, and ngx-editor. These libraries provide tools to develop rich content editors with an Angular-based framework.  

 

How can we render content from an Angular Rich Text Editor?  

We can render the content from an Angular Text Editor using specialized components. It includes components like ngx-quill or ngx-tinymce. These components provide custom elements. It can render the content rendered from a rich text editor. We can then handle the content by component class. It takes care of storing and retrieving the content from the editor. It helps interpret the HTML content used by the respective editor and render it on the page.  

 

Where is the best documentation source for using an Angular wysiwyg editor library?  

The best source of documentation is the official documentation for the specific library. Generally, the documentation will describe how to install, configure, and use the library. You can find tutorials and examples online for various Angular wysiwyg editor libraries.  

 

What features does the powerful API available in this type of library offer?  

The powerful API available in this type of library offers features such as:  

  • Creating, retrieving, and updating information  
  • Access to data in various formats (XML, JSON)  
  • Search and filtering capabilities - Automated data processing and manipulation  
  • Multi-threaded and asynchronous access  
  • Security and authentication controls  
  • Client libraries for easier integration  
  • Support for custom logic and control structures.  

 

How does TinyMCE compare to other wysiwyg editors for angular applications?  

Due to its features and customization options, TinyMCE is an application editor. Compared to other WYSIWYG editors, TinyMCE offers comprehensive features. It makes it very suitable for angular applications. It offers an easy-to-use visual interface. It allows developers to build rich text editors with minimal coding. TinyMCE offers an extensive API for further editor customization. It allows developers to add custom controls, styles, and more.  

 

Can I preview my content using an angular wysiwyg editor library before submitting it?  

Yes, many angular WYSIWYG editors allow you to preview content before submitting. Some popular angular WYSIWYG editors include TinyMCE, CKEditor, and Quill editor. Each editor has a preview mode or button which you helps preview the content before submitting it.  

 

What makes quill-editor stand out compared to other libraries when creating an angular application?  

Quill-editor stands out because it is customizable and has strong community support. It offers a comprehensive selection of tools for developers. It features syntax highlighting, table support, and an API with a plugin architecture. Other features include auto-linking, keyboard shortcuts, tabbed editing, and undo support. Quill-editor has HTML sanitization to help protect users from malicious input and malware. These features make it an ideal library for creating a WYSIWYG editor in an application. 

Jack Dorsey-backed open source and federated, Twitter alternative, Bluesky is now available in the App Store.


Bluesky, the decentralized open source project that originated within Twitter, is available on the Apple App Store as an invite-only social network. Last year, Bluesky was spun off as a separate company, noting that independence was important to the success of the project, and it had added Dorsey to its board.


Bluesky is powered by its open-source social protocol, called the Authenticated Transfer Protocol, or ATP. Bluesky describes it as a “federated social network” where separate networks exist within a single hub. ATP is a protocol for large-scale distributed social applications and holds promise for development for newer social networks that are open with account portability and interoperability.



The AT Protocol is built based on four main ideals

1. account portability

2. algorithmic

3. performance and

4. interoperability.


The framework allows to easily transfer account data to another Bluesky provider and give control over what you see on a network, among other things.


Similar to the ActivityPub protocol that powers Mastodon, AT Protocol offers the means of creating a federated and decentralized social network. However, there’s been criticism of the project from Mastodon and other developers who pointed out that ActivityPub, which a recommended W3C standard, already powers a large and growing “Fediverse” of interconnected servers. Companies including Flipboard, Medium, Tumblr, and possibly Flickr have committed to embracing the ActivityPub standard. The direction of AT Protocol will need to evolve under these circumstances of adoption.


Additional libraries from Bluesky


Description

ChatGPT is a computer program that can talk like humans. Based on a large language model that uses deep learning to generate natural language responses to text-based inputs. It is based on the transformer architecture and has been trained on a massive amount of text data to produce human-like responses to a wide range of queries and conversation topics.

Dependent Libraries Used

Github repository Link:

https://github.com/kandi1clickkits/build-your-own-chatgpt

Solution Source Screenshot

Creating a calendar widget involves building a component. It displays a monthly calendar to navigate between months and highlight selected dates.


Many developers could face it tedious to work with dates and calendar, which can be simplified by using libraries like react-calendar. It has options to pick dates, months, years, or even decades and also has an option to select range of dates. In this solution kit, I am sharing the code snippet and library that I use.


PS: Preview of the output that you will get on running this code from your IDE

Code

In this solution we use the Calendar of the react-calendar library.

  1. Copy the code using the "Copy" button above, and paste it in a react application in your IDE.
  2. Run the application in your server to see the calendar in your page.


You can also add styling to the calendar by adding this piece of code

import 'react-calendar/dist/Calendar.css';


I hope you found this useful. I have added the link to dependent libraries in the following sections.


I found this code snippet by searching for "react calendar" in kandi. You can try any such use case!

Dependent Libraries

Install the react-calendar using above library either by visiting GitHub or npm


You can search for any dependent library on kandi like react-calendar.

Environment Tested

I tested this solution in the following versions. Be mindful of changes when working with other versions.

  1. The solution is created in react v18.2.0 and react-calendar v4.0.0
  2. The solution is tested on chrome browser

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.

React toast libraries offer various options to create and customize toast notifications. They provide a convenient way to display various messages. It displays success notifications, error alerts, warning messages, and informational pop-ups.  

 

Different react toast libraries range from lightweight and minimalistic options. It has more comprehensive and feature-rich solutions. Developers can choose the library that best suits their project requirements.  

 

React toast libraries provide customizable appearance, positioning options, timeout duration, and transition effects. It supports adding custom icons, buttons, or progress bars to the toast notifications. They offer flexibility in styling the toasts to match the design and branding.  

 

Tips for using a react toast library include: 

  • setting up the library in the project, 
  • understanding the available options and API, 
  • handling toast events and callbacks, and 
  • utilizing the library's documentation and examples for guidance. 


React toast libraries can be used in various applications. It is from simple websites or single-page applications to more complex projects. They provide a convenient way to communicate notifications or important information. It helps users in an appealing and non-intrusive manner.  

 

Developers can leverage their features to create applications to make the most of libraries. This includes using appropriate toast types for different scenarios. It provides clear and concise messages, utilizing customization options. It matches the application's style and considers accessibility guidelines for inclusive user experiences.  

 

Writing about these libraries helps cover libraries, features, and customization options. Explaining their benefits enhances user experience and provides real-time feedback. It helps improve usability and can showcase their value to developers.  

 

React toast libraries offer a reliable solution for displaying notifications in React applications. They have become an integral part of many projects with their customizable features. Developers appreciate them for their ability to enhance the user experience. It provides timely information to users.

react-toastify:  

  • This library is used for displaying toast notifications in React applications.  
  • It provides a simple API to create and customize various toasts.  
  • It customizes success messages, error alerts, and informational pop-ups.  
  • It helps improve user experience by providing real-time feedback. 
  • It helps notify users of completed actions and displays important updates or errors.  

react-hot-toast:  

  • This library focuses on simplicity and ease of use. 
  • It allows developers to create and manage toast notifications in React.  
  • It offers a straightforward API with intuitive methods for displaying and dismissing toasts.  
  • It needs a lightweight toast library without sacrificing essential features and customization options.  

react-toast-notifications:  

  • This library offers a lightweight and customizable solution for toast notifications in React.  
  • It supports different notification types, positioning options, and animation effects.  
  • It is suitable for applications that need flexible and appealing toast notifications. 
  • It provides users with timely information and feedback. 

react-native-root-toast:  

  • This library is designed for React Native applications. 
  • It provides toast notification functionalities optimized for mobile development.  
  • It supports customizable toast components with different positions and styles. 
  • It allows developers to deliver relevant and timely notifications to mobile app users.  

react-notifications-component:  

  • This library provides versatile notification components. 
  • It includes toast notifications, alert messages, and dismissible banners.  
  • It supports various configuration options, including timeout duration, appearance, and positioning.  
  • It is useful to communicate important messages or updates to users.  

react-native-sweet-alert:  

  • This library is designed for creating beautiful and customizable alerts and notifications.  
  • It offers various pre-designed templates, animation effects, and customization options.  
  • It can create eye-catching and informative toast notifications, alerts, or confirmation prompts. 
  • It helps enhance the user experience.  

react-bootstrap-toast:  

  • This library integrates Bootstrap styles with toast notifications in React.  
  • It provides a seamless way to display consistent and responsive toast notifications. 
  • It matches the design of a Bootstrap-themed application.  
  • It benefits projects that already use Bootstrap. 
  • It helps maintain a consistent look and feel across their toast notifications.  

react-notistack:  

  • This library focuses on stacking and managing many toast notifications.  
  • It allows developers to enqueue notifications. 
  • It helps control their appearance and behavior and manage the display order.  
  • It generates many notifications and needs an organized and controlled display approach. 

FAQ 

1. What is a simple and customizable React notifications system?  

React notifications system refers allows developers to display notifications in their applications. These systems are designed to be easy to use and customizable. It enables developers to tailor the appearance and behavior of the notifications. It helps suit their specific requirements.  

 

2. How does the React Toast library provide a Delightful and customizable React Component?  

The React Toast library provides a customizable React component for displaying toast notifications. It offers a comprehensive set of options and features. It allows customization of the toast notifications' appearance, position, animation, and behavior. The customization ensures that the notifications integrate with the application's design and user experience.  

 

3. How do I install my project's React toastify npm package?  

To install the React toastify npm package, you can use npm or yarn, package managers used. In your terminal or command prompt, navigate to your directory and run the command:  

npm install react-toastify  

 

4. What examples of notification snackbars can be implemented with this library?  

React Toast libraries provide notification snackbars that your project can implement. These snackbars can include success messages, error alerts, warning notifications, or informational pop-ups. For example, you can display a successful snackbar. It helps notify the user of a successful operation. It helps an error snackbar to alert them of an error or failure or a warning snackbar. It helps provide important warnings or reminders.  

 

5. What kind of toast message options are available in this package?  

The React toastify package offers various toast message options for flexibility and customization. You can define properties like content, appearance, duration, position, transition effect, and sound. These options allow control of your application's toast message appearance and behavior.  

 

6. How do I integrate the Toast Library into my React JS project?  

Integrating the Toast Library into a React JS project involves a few steps. First, import the components from the react-toastify package into your desired component file. You can use components to create and display toast notifications based on events. The Toast Library provides a straightforward API and documentation. It guides you on utilizing the library in your React project. Following the documentation, you can integrate the Toast Library. It helps display notifications in your React application. 

Here are the top NextJS Routing libraries that offer features to the built-in routing systems. It makes it easy to handle complex routing scenarios and improve the user experience. These libraries offer advanced routing features that define complex routes with multiple parameters. Routing libraries will allow you to define dynamic routes, where you can replace the specific parts of the URL with variables. 


It provides middleware support that defines functions executed before or after we handle a route. Routing libraries often support localization and internationalization. It allows you to define translations on your routes. It offers features for handling authorization and authentication to secure your routes easier. It provide SEO features for defining meta tags and other information for improving the search visibility of your routes. It will provide sitemap generation features for easily generating a sitemap for your application. It offers server-side rendering features to render pages on the server and improve performance. 


Here is the list of the top 10 NextJS Routing libraries handpicked to choose the appropriate one as per their requirements:

next-auth:

  • Is a library that offers authorization and authentication features for NextJS applications. 
  • Designed for Serverless but will run anywhere, like Docker, AWS Lambda, Heroku, and many more. 
  • Supports email or passwordless authentication, stateless authentication with any backend.
  • Supports JSON database and Web Tokens sessions.

next-seo:

  • Is a library that offers Search Engine Optimization features for NextJS applications.
  • Enables you to set some default SEO properties which will appear on all your pages without requiring it to be included in any of them.
  • You can override the pages depending on your requirements.
  • Offers a link to indicate the relationship between a mobile website and a desktop to search engines.

next-i18next:

  • Is a library that allows you to add localization and internationalization to your NextJS applications. 
  • Offers internationalized routing directly.
  • It cannot handle any management of content translation or the actual functionality. 
  • Offers the remaining functionalities like translation content management for translating your React components.

next-routes: 

  • A simple wrapper around NextJS routing makes it easier to define handling redirects and dynamic routes. 
  • Offers a flexible and simple method for defining catch-all routes and other complex routing scenarios. 
  • Allows you to define your routes with the help of fluent API and easily handle route and redirecting parameters. 

next-redux-wrapper:

  • Is a library that offers server-side rendering and state management for NextJS applications. 
  • Helps you handle the initial data fetching and rendering of the Redux state management library.
  • Offers an effortless way to integrate with React components on the client. 
  • Can define a wrapper component that wraps your entire NextJS application and offers access to the Redux store.

next-sitemap:

  • Is a library that can generate a sitemap for your NextJS applications. 
  • A sitemap.xml file will list all the pages on your website
  • Offer information about each page, like the change frequency, the last modified date, and the priority. 
  • Makes it easy to generate a sitemap.xml file for your NextJS application. 

next-optimized-images:

  • Is a library that will optimize the images for your NextJS applications. 
  • Helps reduces image size by optimizing images during the build, small inline images to save HTTP requests and roundtrips. 
  • Improves loading speed by offering progressive images.
  • Adding a content hash to the file name so images can get attached on CDN level and in the browser for a long time.

next-offline: 

  • Is a library that allows your NextJS applications to work offline using service workers.  
  • Can intercept cache responses and network requests and respond to requests even if the user is offline. 
  • Can add service worker support to your application using small codes.  

nextjs-auth0:

  • Is a library that offers authentication and authentication features for your NextJS applications.
  • Offers customizable login and logout buttons which you can easily add to your application.
  • Supports various authentication providers, like Google, Twitter, and Facebook.

next-with-apollo:

  • Is a library that offers server-side rendering support for Apollo Client in your NextJS applications. 
  • Offers features for working with GraphQL APIs, like state management, caching, and error handling.
  • Can easily add Apollo to your NextJS application and start working with GraphQL APIs.

Angular Animation Libraries are used for animation-related resources designed for the Angular Framework. Angular Animation Libraries for different processes like Animation Data Visualization and Page Transitions.


These libraries include pre-built animation effects, transitions, and elements. These libraries offer various features for creating engaging and interactive user interfaces. They use a declarative syntax for defining animations, doing reading, and understanding the code easier. Angular animation libraries offer advanced features like SVG, 3D animations, and parallax scrolling. It can be used for creating complex and dynamic user interfaces. It provides interactivity features like click and hover animations. It creates more engagement and interaction. 


Here is a list of handpicked top 9 Angular Animation Libraries of 2024 for your reference:

tsparticles:

  • Is a lightweight JavaScript library that we can use to create particle animations. 
  • Offers an effortless way for adding particle effects to web applications with a focus on flexibility and performance. 
  • Allows customization the particle animations like particle shape, size, density, speed, and color.
  • Making it easy to create a unique and visually appealing particle effect that matches the design and UI goals. 

rxviz:

  • Is a web-based reactive programming framework that visualizes the behavior of RxJS Observables. 
  • Is a popular library for reactive programming in JavaScript and is used in Angular applications. 
  • Offers a graphical representation of Observable streams to visualize how data flows through the application.
  • Making it easy to identify issues and optimize the application behavior. 

angular-scroll:

  • Is an Angular library that offers smooth scrolling animations for web applications.
  • Allows developers to create scrolling animations that smoothly transition between different application sections. 
  • Offers an effortless way to create anchor links that scroll to a specific application section
  • Allows users to navigate to various sections without manually scrolling through the content. 
  • Can create smooth scrolling animations to enhance web applications' visual appeal and UI.

angularjs-slider:

  • Is a library that offers a customizable range slider for AngularJS applications. 
  • Allows developers to create range sliders.
  • Allow users to select a range of values within a defined set, like choosing a range of prices or dates. 
  • Offers a range of customization options that will help developers fine-tune their slider to match the design and UI goals.

ngAnimate:

  • Is a built-in Angular library that offers support for animations in Angular applications.
  • Allows developers to create animations by changing the application state. 
  • Is built into Angular, which makes it easy to add animations to existing applications.
  • Create a new application with built-in animation features. 

delighters:

  • Is an Angular library that offers a straightforward way to add subtle and engaging animations to web pages. 
  • Allows developers to create animations triggered as the user scrolls through the page.
  • Offering a more dynamic and engaging UI. 
  • Is a lightweight library that has minimal impact on the overall performance of the web application. 

angular-svg-round-progressbar:

  • Is an Angular library that offers a circular, customizable progress bar using SVG graphics. 
  • Allows developers to create circular progress, which shows the progress of an ongoing process.
  • Offering a visual cue for users of the application status. 
  • Offers various options to fine-tune the progress bar to match the application's design and user experience goals.

ngx-spinner:

  • Allows developers to customize the loading spinners with diverse options like size, style, and color.
  • Making it easier to create loading spinners that match the design and UI goals. 
  • Can be integrated with different web technologies like React, vanilla JavaScript, and Angular.
  • Making it easier to add loading spinners to the current web applications or create new ones. 
  • Is designed to be accessible with support for screen readers and keyboard navigation.
  • Ensuring users can navigate and interact with the application.

angular-spinner:

  • Is an Angular library that provides an effortless way to add loading spinners for web applications. 
  • Allows developers to create loading spinners that appear if data is fetched or processed.
  • Providing a visual cue to users which application is working. 
  • Offers multiple spinner types, like spinner dots and lines.
  • Allowing developers to choose the spinner type that best fits the application's design and user interface goals.

The top Angular Calendar libraries for developing complex and dynamic web applications are here. We can use Angular Calendar libraries to create different applications involving data visualization, scheduling, and resource management. 

 

Using a library instead of building it from scratch can save more time and ensure its reliability, visual appearance, and responsiveness. Angular Calendar libraries are used for scheduling, customizing, displaying events & appointments, resource management, and integrating with other applications.   


The top 9 Angular Calendar libraries are shown below. Here is a detailed review of each library. 

fullcalendar: 

  • Is a JavaScript calendar library that uses Angular.  
  • Provides various views like months, weeks, days, agenda, etc.  
  • Can be customized easily to meet your needs and supports event drag-and-drop, styling options, and resizing. 

primeng: 

  • Is a UI component library for Angular which offers various pre-built components, including a calendar component.  
  • Greatly simplifies the codebase by removing a significant amount of code related to scrolling and offers new features like freezing columns and sticky row groups.   
  • Supports events like times, details, and diverse colors.   

angular-calendar: 

  • Is a fully featured calendar library for Angular, which provides various customizable options for displaying appointments and events.   
  • For getting more flexibility, there are more boilerplate requirements for getting up and running the calendar.   
  • No component styles are included with every component making it easier to override.   

CalendarKit: 

  • Is a Swift or Angular Calendar UI library for iOS and Mac Catalyst.  
  • Allows customization when required, which provides resizing, multiple view modes, and drag-and-drop options.  
  • Composed of different modules that can be used together or independently.   

gnatt-schedule-timeline-calendar: 

  • Is a library that is used for creating visual representations of timelines, calendars, and project schedules.  
  • Can help with project planning and management.  
  • Is super-fast, elastic, and movable and snaps to a specified time when resizing and offers a tree-like output.   

calendar-heatmap: 

  • Is a lightweight calendar library that offers a heatmap view to display data. 
  • Is a d3 heatmap to represent time series data like GitHub’s Contribution chart. 
  • Is easy to use and can be customized using CSS to match your project’s design. 

add-to-calendar-button: 

  • Is a convenient JavaScript snippet that lets us reliably create beautiful buttons that people can use to add events to their calendars.  
  • The main goal is to keep the process as easy as possible at maximum compatibility.  
  • Is a web component that easily integrates with any HTML webpage and popular frameworks like Angular, Vue, React, and more.   

fullcalendar-angular: 

  • Is an Angular component of the full calendar library, which offers a component that matches the functionality of fullcalendar’s standard API. 
  • Allows developers to create interactive and rich calendar views in Angular applications.  
  • Supports Angular 2 and higher versions and integrates with FullCalendar’s rich set of features.  

angular-bootstrap-calendar: 

  • Is an easy-to-use and lightweight calendar library built on the Bootstrap framework for Angular. 
  • Provides a set of Angular directives that wrap up the Bootstrap calendar functionality.  
  • Offers an Angular-style API for interacting with the calendar making it easy to create customizable calendar views.   

Trending Discussions on TypeScript

React 18 TypeScript children FC

AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire

ESLint: 8.0.0 Failed to load plugin '@typescript-eslint'

Why does typescript allow me to import dependencies it can't use at runtime?

The unauthenticated git protocol on port 9418 is no longer supported

in Typescript, try...catch error object shows "Object is of type 'unknown'.ts(2571)"

Uncaught ReferenceError: Buffer is not defined

ESlint - Error: Must use import to load ES Module

npx create-react-app prompting to globally uninstall non-existent create-react-app package?

react native typescript 'string' is not assignable to parameter of type 'never.' in useNavigation

QUESTION

React 18 TypeScript children FC

Asked 2022-Apr-09 at 23:47

I upgraded to React 18 and things compiled fine. Today it seems every single component that uses children is throwing an error. Property 'children' does not exist on type 'IPageProps'.

Before children props were automatically included in the FC interface. Now it seems I have to manually add children: ReactNode. What is the correct typescript type for react children?

Is this part of the React 18 update, or is something screwed up in my env?

package.json

1"react": "^18.0.0",
2"react-dom": "^18.0.0",
3"next": "12.1.4",
4"@types/react": "18.0.0",
5"@types/react-dom": "18.0.0",
6

tsconfig.json

1"react": "^18.0.0",
2"react-dom": "^18.0.0",
3"next": "12.1.4",
4"@types/react": "18.0.0",
5"@types/react-dom": "18.0.0",
6{
7  "compilerOptions": {
8    "target": "esnext",
9    "lib": ["dom", "dom.iterable", "esnext"],
10    "allowJs": true,
11    "skipLibCheck": true,
12    "esModuleInterop": true,
13    "allowSyntheticDefaultImports": true,
14    "strict": true,
15    "forceConsistentCasingInFileNames": true,
16    "module": "esnext",
17    "moduleResolution": "node",
18    "resolveJsonModule": true,
19    "isolatedModules": true,
20    "noEmit": true,
21    "jsx": "preserve",
22    "alwaysStrict": true,
23    "sourceMap": true,
24    "incremental": true
25  },
26  "include": ["src"],
27  "exclude": ["node_modules"]
28}
29

ANSWER

Answered 2022-Apr-07 at 20:34

It looks like the children attribute on the typescript typings were removed.

I had to manually add children to my props; There is probably a better solution to fix this, but in the interim, this works.

Source https://stackoverflow.com/questions/71788254

QUESTION

AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire

Asked 2022-Apr-01 at 12:56

I am trying to implement Firebase Realtime Database into a angular project and Im getting stuck at one of the very first steps. Importing AngularFireModule and AngularFireDatabaseModule. It gives me the following error:

1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2
1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3

And here is how I am importing them:

1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5

Am I missing something here? I have installed @angular/fire via the command

1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6

and have also installed firebase tools. Here is a list of the Angular packages I currently have installed and their versions:

1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package                         Version
16---------------------------------------------------------
17@angular-devkit/architect       0.1202.2
18@angular-devkit/build-angular   12.2.2
19@angular-devkit/core            12.2.2
20@angular-devkit/schematics      12.2.2
21@angular/cli                    12.2.2
22@angular/fire                   7.0.0
23@schematics/angular             12.2.2
24rxjs                            6.6.7
25typescript                      4.3.5
26

I do apologise if this is all excessive information but I am completely stuck as to what the issue is. Any help would be GREATLY appreciated. Right now my suspicion is that its a compatibility issue or perhaps a feature that doesnt exist anymore on the latest versions but I really dont know.

ANSWER

Answered 2021-Aug-26 at 13:20

AngularFire 7.0.0 was launched yesterday with a new API that has a lot of bundle size reduction benefits.

Instead of top level classes like AngularFireDatabase, you can now import smaller independent functions.

1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package                         Version
16---------------------------------------------------------
17@angular-devkit/architect       0.1202.2
18@angular-devkit/build-angular   12.2.2
19@angular-devkit/core            12.2.2
20@angular-devkit/schematics      12.2.2
21@angular/cli                    12.2.2
22@angular/fire                   7.0.0
23@schematics/angular             12.2.2
24rxjs                            6.6.7
25typescript                      4.3.5
26import { list } from '@angular/fire/database';
27

The initialization process is a bit different too as it has a more flexible API for specifying configurations.

1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package                         Version
16---------------------------------------------------------
17@angular-devkit/architect       0.1202.2
18@angular-devkit/build-angular   12.2.2
19@angular-devkit/core            12.2.2
20@angular-devkit/schematics      12.2.2
21@angular/cli                    12.2.2
22@angular/fire                   7.0.0
23@schematics/angular             12.2.2
24rxjs                            6.6.7
25typescript                      4.3.5
26import { list } from '@angular/fire/database';
27@NgModule({
28    imports: [
29        provideFirebaseApp(() => initializeApp(config)),
30        provideFirestore(() => {
31            const firestore = getFirestore();
32            connectEmulator(firestore, 'localhost', 8080);
33            enableIndexedDbPersistence(firestore);
34            return firestore;
35        }),
36        provideStorage(() => getStorage()),
37    ],
38})
39

If you want to proceed with the older API there's a compatibility layer.

1Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
2Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package                         Version
16---------------------------------------------------------
17@angular-devkit/architect       0.1202.2
18@angular-devkit/build-angular   12.2.2
19@angular-devkit/core            12.2.2
20@angular-devkit/schematics      12.2.2
21@angular/cli                    12.2.2
22@angular/fire                   7.0.0
23@schematics/angular             12.2.2
24rxjs                            6.6.7
25typescript                      4.3.5
26import { list } from '@angular/fire/database';
27@NgModule({
28    imports: [
29        provideFirebaseApp(() => initializeApp(config)),
30        provideFirestore(() => {
31            const firestore = getFirestore();
32            connectEmulator(firestore, 'localhost', 8080);
33            enableIndexedDbPersistence(firestore);
34            return firestore;
35        }),
36        provideStorage(() => getStorage()),
37    ],
38})
39import { AngularFireModule} from '@angular/fire/compat'
40import { AngularFireDatabaseModule } from '@angular/fire/compat/database';
41

Source https://stackoverflow.com/questions/68939014

QUESTION

ESLint: 8.0.0 Failed to load plugin '@typescript-eslint'

Asked 2022-Mar-31 at 09:08

Could you help me, I've got this error when I try building a project?

Oops! Something went wrong! :(

ESLint: 8.0.0

TypeError: Failed to load plugin '@typescript-eslint' declared in 'src.eslintrc': Class extends value undefined is not a constructor or null Referenced from: src.eslintrc

package.json

1    "devDependencies": {
2        "@typescript-eslint/eslint-plugin": "^4.33.0",
3        "@typescript-eslint/parser": "^4.33.0",
4        "browserslist": "^4.17.3",
5        "eslint": "^8.0.0",
6        "eslint-config-prettier": "^8.3.0",
7        "eslint-plugin-import": "^2.24.2",
8        "eslint-plugin-prettier": "^4.0.0",
9        "eslint-plugin-react": "^7.26.1",
10        "prettier": "^2.3.2",
11    }
12

.eslintrc

1    "devDependencies": {
2        "@typescript-eslint/eslint-plugin": "^4.33.0",
3        "@typescript-eslint/parser": "^4.33.0",
4        "browserslist": "^4.17.3",
5        "eslint": "^8.0.0",
6        "eslint-config-prettier": "^8.3.0",
7        "eslint-plugin-import": "^2.24.2",
8        "eslint-plugin-prettier": "^4.0.0",
9        "eslint-plugin-react": "^7.26.1",
10        "prettier": "^2.3.2",
11    }
12    "parser": "@typescript-eslint/parser",
13    "extends": [
14        "eslint:recommended",
15        "plugin:@typescript-eslint/eslint-recommended",
16        "plugin:@typescript-eslint/recommended",
17        "plugin:react/recommended",
18        "plugin:@typescript-eslint/recommended",
19        "plugin:prettier/recommended",
20        "prettier"
21    ],
22    "plugins": ["@typescript-eslint"],
23

ANSWER

Answered 2021-Oct-10 at 10:33

Source https://stackoverflow.com/questions/69513869

QUESTION

Why does typescript allow me to import dependencies it can't use at runtime?

Asked 2022-Mar-28 at 07:32

You can see my sample project here: https://github.com/DanKaplanSES/typescript-stub-examples/tree/JavaScript-import-invalid

I have created this file called main.ts:

1import uuid from "uuid";
2
3console.log(uuid.v4());
4
5

Although typescript is fine with this import, when I try to node main.js, it gives this error:

1import uuid from "uuid";
2
3console.log(uuid.v4());
4
5console.log(uuid_1["default"].v4());
6                              ^
7
8TypeError: Cannot read property 'v4' of undefined
9    at Object.<anonymous> (C:\root\lib\main.js:5:31)
10←[90m    at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
11←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
12←[90m    at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
13←[90m    at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
14←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
15←[90m    at internal/main/run_main_module.js:17:47←[39m
16

If I change the file to this, it executes fine:

1import uuid from "uuid";
2
3console.log(uuid.v4());
4
5console.log(uuid_1["default"].v4());
6                              ^
7
8TypeError: Cannot read property 'v4' of undefined
9    at Object.<anonymous> (C:\root\lib\main.js:5:31)
10←[90m    at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
11←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
12←[90m    at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
13←[90m    at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
14←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
15←[90m    at internal/main/run_main_module.js:17:47←[39m
16import * as uuid from "uuid";
17
18console.log(uuid.v4());
19

If the first version is invalid, why doesn't typescript inform me?

I have a multi file tsconfig setup. Check the github project for more details, but here are the shared compiler options which may be relevant:

1import uuid from "uuid";
2
3console.log(uuid.v4());
4
5console.log(uuid_1["default"].v4());
6                              ^
7
8TypeError: Cannot read property 'v4' of undefined
9    at Object.<anonymous> (C:\root\lib\main.js:5:31)
10←[90m    at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
11←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
12←[90m    at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
13←[90m    at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
14←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
15←[90m    at internal/main/run_main_module.js:17:47←[39m
16import * as uuid from "uuid";
17
18console.log(uuid.v4());
19{
20    "compilerOptions": {
21        "rootDir": ".",
22        "esModuleInterop": true,
23        "module": "CommonJS",
24        "moduleResolution": "node",
25        "composite": true,
26        "importHelpers": true,
27    },
28}
29

Here is how the main.js looks:

doesn't work
1import uuid from "uuid";
2
3console.log(uuid.v4());
4
5console.log(uuid_1["default"].v4());
6                              ^
7
8TypeError: Cannot read property 'v4' of undefined
9    at Object.<anonymous> (C:\root\lib\main.js:5:31)
10←[90m    at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
11←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
12←[90m    at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
13←[90m    at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
14←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
15←[90m    at internal/main/run_main_module.js:17:47←[39m
16import * as uuid from "uuid";
17
18console.log(uuid.v4());
19{
20    "compilerOptions": {
21        "rootDir": ".",
22        "esModuleInterop": true,
23        "module": "CommonJS",
24        "moduleResolution": "node",
25        "composite": true,
26        "importHelpers": true,
27    },
28}
29"use strict";
30exports.__esModule = true;
31var tslib_1 = require("tslib");
32var uuid_1 = tslib_1.__importDefault(require("uuid"));
33console.log(uuid_1["default"].v4());
34
works
1import uuid from "uuid";
2
3console.log(uuid.v4());
4
5console.log(uuid_1["default"].v4());
6                              ^
7
8TypeError: Cannot read property 'v4' of undefined
9    at Object.<anonymous> (C:\root\lib\main.js:5:31)
10←[90m    at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
11←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
12←[90m    at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
13←[90m    at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
14←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
15←[90m    at internal/main/run_main_module.js:17:47←[39m
16import * as uuid from "uuid";
17
18console.log(uuid.v4());
19{
20    "compilerOptions": {
21        "rootDir": ".",
22        "esModuleInterop": true,
23        "module": "CommonJS",
24        "moduleResolution": "node",
25        "composite": true,
26        "importHelpers": true,
27    },
28}
29"use strict";
30exports.__esModule = true;
31var tslib_1 = require("tslib");
32var uuid_1 = tslib_1.__importDefault(require("uuid"));
33console.log(uuid_1["default"].v4());
34"use strict";
35exports.__esModule = true;
36var tslib_1 = require("tslib");
37var uuid = tslib_1.__importStar(require("uuid"));
38console.log(uuid.v4());
39

ANSWER

Answered 2021-Sep-26 at 13:34

Your issue is related to interoperability between TypeScript/ECMAScript modules and CommonJS.

When it comes to the differences between ECMAScript modules and CommonJS modules:

  • CommonJS modules are meant to be imported like const library = require('library') which allows to retrieve the full exports object of that library. There is no notion of default import in CommonJS
  • ECMAScript modules have explicit export clauses for every exported item. They also feature a default import syntax which allows to retrieve the default export in a local variable.

In order to implement interoperability between CommonJS modules and TypeScript's default import syntax, CommonJS modules can have a default property.

That default property can even be added automatically by TypeScript when esModuleInterop is enabled (which also enables allowSyntheticDefaultImports). This option adds this helper function at transpilation time:

1import uuid from "uuid";
2
3console.log(uuid.v4());
4
5console.log(uuid_1["default"].v4());
6                              ^
7
8TypeError: Cannot read property 'v4' of undefined
9    at Object.<anonymous> (C:\root\lib\main.js:5:31)
10←[90m    at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
11←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
12←[90m    at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
13←[90m    at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
14←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
15←[90m    at internal/main/run_main_module.js:17:47←[39m
16import * as uuid from "uuid";
17
18console.log(uuid.v4());
19{
20    "compilerOptions": {
21        "rootDir": ".",
22        "esModuleInterop": true,
23        "module": "CommonJS",
24        "moduleResolution": "node",
25        "composite": true,
26        "importHelpers": true,
27    },
28}
29"use strict";
30exports.__esModule = true;
31var tslib_1 = require("tslib");
32var uuid_1 = tslib_1.__importDefault(require("uuid"));
33console.log(uuid_1["default"].v4());
34"use strict";
35exports.__esModule = true;
36var tslib_1 = require("tslib");
37var uuid = tslib_1.__importStar(require("uuid"));
38console.log(uuid.v4());
39var __importDefault = (this && this.__importDefault) || function (mod) {
40    return (mod && mod.__esModule) ? mod : { "default": mod };
41};
42

Basically what this function does is: if the imported module has the __esModule flag set to true, export it as is because the module is intended to be used as an ECMAScript module: import { feature } from 'library'. Otherwise, export it inside a wrapper object with a default property, which enables the import localName from 'library' syntax.

The uuid package is being built with @babel/plugin-transform-modules-commonjs which includes the __esModule flag and prevents you from using the default import syntax. Other packages like lodash don't include this flag, which allows TypeScript to add the default property.

As a conclusion, TypeScript provides options to interoperate with legacy CommonJS modules but these options don't work with "ECMAScript aware" CommonJS modules. TypeScript cannot warn or error out at transpilation time because a CommonJS module interface has no representation other than the exports object, which is only known at runtime.

Source https://stackoverflow.com/questions/69200697

QUESTION

The unauthenticated git protocol on port 9418 is no longer supported

Asked 2022-Mar-27 at 13:23

I have been using github actions for quite sometime but today my deployments started failing. Below is the error from github action logs

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7

Upon investigation, it appears that below section in my yml file is causing the issue.

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9

I have looked into this change log but can't seem to comprehend the issue.

Additional Details: Server: EC2 Instance Github actions steps:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55

package.json file

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  "name": "stackstream-fe",
57  "version": "1.0.0",
58  "authors": [
59    "fayyaznofal@gmail.com"
60  ],
61  "private": true,
62  "dependencies": {
63    "@fortawesome/fontawesome-svg-core": "^1.2.34",
64    "@fortawesome/free-solid-svg-icons": "^5.15.2",
65    "@fortawesome/react-fontawesome": "^0.1.14",
66    "@fullcalendar/bootstrap": "^5.5.0",
67    "@fullcalendar/core": "^5.5.0",
68    "@fullcalendar/daygrid": "^5.5.0",
69    "@fullcalendar/interaction": "^5.5.0",
70    "@fullcalendar/react": "^5.5.0",
71    "@lourenci/react-kanban": "^2.1.0",
72    "@redux-saga/simple-saga-monitor": "^1.1.2",
73    "@testing-library/jest-dom": "^5.11.9",
74    "@testing-library/react": "^11.2.3",
75    "@testing-library/user-event": "^12.6.0",
76    "@toast-ui/react-chart": "^1.0.2",
77    "@types/jest": "^26.0.14",
78    "@types/node": "^14.10.3",
79    "@types/react": "^16.9.49",
80    "@types/react-dom": "^16.9.8",
81    "@vtaits/react-color-picker": "^0.1.1",
82    "apexcharts": "^3.23.1",
83    "availity-reactstrap-validation": "^2.7.0",
84    "axios": "^0.21.1",
85    "axios-mock-adapter": "^1.19.0",
86    "axios-progress-bar": "^1.2.0",
87    "bootstrap": "^5.0.0-beta2",
88    "chart.js": "^2.9.4",
89    "chartist": "^0.11.4",
90    "classnames": "^2.2.6",
91    "components": "^0.1.0",
92    "dotenv": "^8.2.0",
93    "draft-js": "^0.11.7",
94    "echarts": "^4.9.0",
95    "echarts-for-react": "^2.0.16",
96    "firebase": "^8.2.3",
97    "google-maps-react": "^2.0.6",
98    "history": "^4.10.1",
99    "i": "^0.3.6",
100    "i18next": "^19.8.4",
101    "i18next-browser-languagedetector": "^6.0.1",
102    "jsonwebtoken": "^8.5.1",
103    "leaflet": "^1.7.1",
104    "lodash": "^4.17.21",
105    "lodash.clonedeep": "^4.5.0",
106    "lodash.get": "^4.4.2",
107    "metismenujs": "^1.2.1",
108    "mkdirp": "^1.0.4",
109    "moment": "2.29.1",
110    "moment-timezone": "^0.5.32",
111    "nouislider-react": "^3.3.9",
112    "npm": "^7.6.3",
113    "prop-types": "^15.7.2",
114    "query-string": "^6.14.0",
115    "react": "^16.13.1",
116    "react-apexcharts": "^1.3.7",
117    "react-auth-code-input": "^1.0.0",
118    "react-avatar": "^3.10.0",
119    "react-bootstrap": "^1.5.0",
120    "react-bootstrap-editable": "^0.8.2",
121    "react-bootstrap-sweetalert": "^5.2.0",
122    "react-bootstrap-table-next": "^4.0.3",
123    "react-bootstrap-table2-editor": "^1.4.0",
124    "react-bootstrap-table2-paginator": "^2.1.2",
125    "react-bootstrap-table2-toolkit": "^2.1.3",
126    "react-chartist": "^0.14.3",
127    "react-chartjs-2": "^2.11.1",
128    "react-color": "^2.19.3",
129    "react-confirm-alert": "^2.7.0",
130    "react-content-loader": "^6.0.1",
131    "react-countdown": "^2.3.1",
132    "react-countup": "^4.3.3",
133    "react-cropper": "^2.1.4",
134    "react-data-table-component": "^6.11.8",
135    "react-date-picker": "^8.0.6",
136    "react-datepicker": "^3.4.1",
137    "react-dom": "^16.13.1",
138    "react-draft-wysiwyg": "^1.14.5",
139    "react-drag-listview": "^0.1.8",
140    "react-drawer": "^1.3.4",
141    "react-dropzone": "^11.2.4",
142    "react-dual-listbox": "^2.0.0",
143    "react-facebook-login": "^4.1.1",
144    "react-flatpickr": "^3.10.6",
145    "react-google-login": "^5.2.2",
146    "react-hook-form": "^7.15.2",
147    "react-i18next": "^11.8.5",
148    "react-icons": "^4.2.0",
149    "react-image-lightbox": "^5.1.1",
150    "react-input-mask": "^2.0.4",
151    "react-jvectormap": "^0.0.16",
152    "react-leaflet": "^3.0.5",
153    "react-meta-tags": "^1.0.1",
154    "react-modal-video": "^1.2.6",
155    "react-notifications": "^1.7.2",
156    "react-number-format": "^4.7.3",
157    "react-perfect-scrollbar": "^1.5.8",
158    "react-rangeslider": "^2.2.0",
159    "react-rating": "^2.0.5",
160    "react-rating-tooltip": "^1.1.6",
161    "react-redux": "^7.2.1",
162    "react-responsive-carousel": "^3.2.11",
163    "react-router-dom": "^5.2.0",
164    "react-script": "^2.0.5",
165    "react-scripts": "3.4.3",
166    "react-select": "^4.3.1",
167    "react-sparklines": "^1.7.0",
168    "react-star-ratings": "^2.3.0",
169    "react-super-responsive-table": "^5.2.0",
170    "react-switch": "^6.0.0",
171    "react-table": "^7.6.3",
172    "react-toastify": "^7.0.3",
173    "react-toastr": "^3.0.0",
174    "react-twitter-auth": "0.0.13",
175    "reactstrap": "^8.8.1",
176    "recharts": "^2.0.8",
177    "redux": "^4.0.5",
178    "redux-saga": "^1.1.3",
179    "reselect": "^4.0.0",
180    "sass": "^1.37.5",
181    "simplebar-react": "^2.3.0",
182    "styled": "^1.0.0",
183    "styled-components": "^5.2.1",
184    "toastr": "^2.1.4",
185    "typescript": "^4.0.2",
186    "universal-cookie": "^4.0.4"
187  },
188  "devDependencies": {
189    "@typescript-eslint/eslint-plugin": "^2.27.0",
190    "@typescript-eslint/parser": "^2.27.0",
191    "@typescript-eslint/typescript-estree": "^4.15.2",
192    "eslint-config-prettier": "^6.10.1",
193    "eslint-plugin-prettier": "^3.1.2",
194    "husky": "^4.2.5",
195    "lint-staged": "^10.1.3",
196    "prettier": "^1.19.1",
197    "react-test-renderer": "^16.13.1",
198    "redux-devtools-extension": "^2.13.8",
199    "redux-mock-store": "^1.5.4"
200  },
201  "scripts": {
202    "start": "react-scripts start",
203    "build": "react-scripts build && mv build ./deploy/build",
204    "build-local": "react-scripts build",
205    "test": "react-scripts test",
206    "eject": "react-scripts eject"
207  },
208  "eslintConfig": {
209    "extends": "react-app"
210  },
211  "husky": {
212    "hooks": {
213      "pre-commit": "lint-staged"
214    }
215  },
216  "lint-staged": {
217    "*.{js,ts,tsx}": [
218      "eslint --fix"
219    ]
220  },
221  "browserslist": {
222    "production": [
223      ">0.2%",
224      "not dead",
225      "not op_mini all"
226    ],
227    "development": [
228      "last 1 chrome version",
229      "last 1 firefox version",
230      "last 1 safari version"
231    ]
232  }
233}
234

ANSWER

Answered 2022-Mar-16 at 07:01

First, this error message is indeed expected on Jan. 11th, 2022.
See "Improving Git protocol security on GitHub".

January 11, 2022 Final brownout.

This is the full brownout period where we’ll temporarily stop accepting the deprecated key and signature types, ciphers, and MACs, and the unencrypted Git protocol.
This will help clients discover any lingering use of older keys or old URLs.

Second, check your package.json dependencies for any git:// URL, as in this example, fixed in this PR.

As noted by Jörg W Mittag:

There was a 4-month warning.
The entire Internet has been moving away from unauthenticated, unencrypted protocols for a decade, it's not like this is a huge surprise.

Personally, I consider it less an "issue" and more "detecting unmaintained dependencies".

Plus, this is still only the brownout period, so the protocol will only be disabled for a short period of time, allowing developers to discover the problem.

The permanent shutdown is not until March 15th.


For GitHub Actions:

As in actions/checkout issue 14, you can add as a first step:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  "name": "stackstream-fe",
57  "version": "1.0.0",
58  "authors": [
59    "fayyaznofal@gmail.com"
60  ],
61  "private": true,
62  "dependencies": {
63    "@fortawesome/fontawesome-svg-core": "^1.2.34",
64    "@fortawesome/free-solid-svg-icons": "^5.15.2",
65    "@fortawesome/react-fontawesome": "^0.1.14",
66    "@fullcalendar/bootstrap": "^5.5.0",
67    "@fullcalendar/core": "^5.5.0",
68    "@fullcalendar/daygrid": "^5.5.0",
69    "@fullcalendar/interaction": "^5.5.0",
70    "@fullcalendar/react": "^5.5.0",
71    "@lourenci/react-kanban": "^2.1.0",
72    "@redux-saga/simple-saga-monitor": "^1.1.2",
73    "@testing-library/jest-dom": "^5.11.9",
74    "@testing-library/react": "^11.2.3",
75    "@testing-library/user-event": "^12.6.0",
76    "@toast-ui/react-chart": "^1.0.2",
77    "@types/jest": "^26.0.14",
78    "@types/node": "^14.10.3",
79    "@types/react": "^16.9.49",
80    "@types/react-dom": "^16.9.8",
81    "@vtaits/react-color-picker": "^0.1.1",
82    "apexcharts": "^3.23.1",
83    "availity-reactstrap-validation": "^2.7.0",
84    "axios": "^0.21.1",
85    "axios-mock-adapter": "^1.19.0",
86    "axios-progress-bar": "^1.2.0",
87    "bootstrap": "^5.0.0-beta2",
88    "chart.js": "^2.9.4",
89    "chartist": "^0.11.4",
90    "classnames": "^2.2.6",
91    "components": "^0.1.0",
92    "dotenv": "^8.2.0",
93    "draft-js": "^0.11.7",
94    "echarts": "^4.9.0",
95    "echarts-for-react": "^2.0.16",
96    "firebase": "^8.2.3",
97    "google-maps-react": "^2.0.6",
98    "history": "^4.10.1",
99    "i": "^0.3.6",
100    "i18next": "^19.8.4",
101    "i18next-browser-languagedetector": "^6.0.1",
102    "jsonwebtoken": "^8.5.1",
103    "leaflet": "^1.7.1",
104    "lodash": "^4.17.21",
105    "lodash.clonedeep": "^4.5.0",
106    "lodash.get": "^4.4.2",
107    "metismenujs": "^1.2.1",
108    "mkdirp": "^1.0.4",
109    "moment": "2.29.1",
110    "moment-timezone": "^0.5.32",
111    "nouislider-react": "^3.3.9",
112    "npm": "^7.6.3",
113    "prop-types": "^15.7.2",
114    "query-string": "^6.14.0",
115    "react": "^16.13.1",
116    "react-apexcharts": "^1.3.7",
117    "react-auth-code-input": "^1.0.0",
118    "react-avatar": "^3.10.0",
119    "react-bootstrap": "^1.5.0",
120    "react-bootstrap-editable": "^0.8.2",
121    "react-bootstrap-sweetalert": "^5.2.0",
122    "react-bootstrap-table-next": "^4.0.3",
123    "react-bootstrap-table2-editor": "^1.4.0",
124    "react-bootstrap-table2-paginator": "^2.1.2",
125    "react-bootstrap-table2-toolkit": "^2.1.3",
126    "react-chartist": "^0.14.3",
127    "react-chartjs-2": "^2.11.1",
128    "react-color": "^2.19.3",
129    "react-confirm-alert": "^2.7.0",
130    "react-content-loader": "^6.0.1",
131    "react-countdown": "^2.3.1",
132    "react-countup": "^4.3.3",
133    "react-cropper": "^2.1.4",
134    "react-data-table-component": "^6.11.8",
135    "react-date-picker": "^8.0.6",
136    "react-datepicker": "^3.4.1",
137    "react-dom": "^16.13.1",
138    "react-draft-wysiwyg": "^1.14.5",
139    "react-drag-listview": "^0.1.8",
140    "react-drawer": "^1.3.4",
141    "react-dropzone": "^11.2.4",
142    "react-dual-listbox": "^2.0.0",
143    "react-facebook-login": "^4.1.1",
144    "react-flatpickr": "^3.10.6",
145    "react-google-login": "^5.2.2",
146    "react-hook-form": "^7.15.2",
147    "react-i18next": "^11.8.5",
148    "react-icons": "^4.2.0",
149    "react-image-lightbox": "^5.1.1",
150    "react-input-mask": "^2.0.4",
151    "react-jvectormap": "^0.0.16",
152    "react-leaflet": "^3.0.5",
153    "react-meta-tags": "^1.0.1",
154    "react-modal-video": "^1.2.6",
155    "react-notifications": "^1.7.2",
156    "react-number-format": "^4.7.3",
157    "react-perfect-scrollbar": "^1.5.8",
158    "react-rangeslider": "^2.2.0",
159    "react-rating": "^2.0.5",
160    "react-rating-tooltip": "^1.1.6",
161    "react-redux": "^7.2.1",
162    "react-responsive-carousel": "^3.2.11",
163    "react-router-dom": "^5.2.0",
164    "react-script": "^2.0.5",
165    "react-scripts": "3.4.3",
166    "react-select": "^4.3.1",
167    "react-sparklines": "^1.7.0",
168    "react-star-ratings": "^2.3.0",
169    "react-super-responsive-table": "^5.2.0",
170    "react-switch": "^6.0.0",
171    "react-table": "^7.6.3",
172    "react-toastify": "^7.0.3",
173    "react-toastr": "^3.0.0",
174    "react-twitter-auth": "0.0.13",
175    "reactstrap": "^8.8.1",
176    "recharts": "^2.0.8",
177    "redux": "^4.0.5",
178    "redux-saga": "^1.1.3",
179    "reselect": "^4.0.0",
180    "sass": "^1.37.5",
181    "simplebar-react": "^2.3.0",
182    "styled": "^1.0.0",
183    "styled-components": "^5.2.1",
184    "toastr": "^2.1.4",
185    "typescript": "^4.0.2",
186    "universal-cookie": "^4.0.4"
187  },
188  "devDependencies": {
189    "@typescript-eslint/eslint-plugin": "^2.27.0",
190    "@typescript-eslint/parser": "^2.27.0",
191    "@typescript-eslint/typescript-estree": "^4.15.2",
192    "eslint-config-prettier": "^6.10.1",
193    "eslint-plugin-prettier": "^3.1.2",
194    "husky": "^4.2.5",
195    "lint-staged": "^10.1.3",
196    "prettier": "^1.19.1",
197    "react-test-renderer": "^16.13.1",
198    "redux-devtools-extension": "^2.13.8",
199    "redux-mock-store": "^1.5.4"
200  },
201  "scripts": {
202    "start": "react-scripts start",
203    "build": "react-scripts build && mv build ./deploy/build",
204    "build-local": "react-scripts build",
205    "test": "react-scripts test",
206    "eject": "react-scripts eject"
207  },
208  "eslintConfig": {
209    "extends": "react-app"
210  },
211  "husky": {
212    "hooks": {
213      "pre-commit": "lint-staged"
214    }
215  },
216  "lint-staged": {
217    "*.{js,ts,tsx}": [
218      "eslint --fix"
219    ]
220  },
221  "browserslist": {
222    "production": [
223      ">0.2%",
224      "not dead",
225      "not op_mini all"
226    ],
227    "development": [
228      "last 1 chrome version",
229      "last 1 firefox version",
230      "last 1 safari version"
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig
236

That will change any git://github.com/ into https://github.com/.

For local projects

For all your repositories, you can set:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  "name": "stackstream-fe",
57  "version": "1.0.0",
58  "authors": [
59    "fayyaznofal@gmail.com"
60  ],
61  "private": true,
62  "dependencies": {
63    "@fortawesome/fontawesome-svg-core": "^1.2.34",
64    "@fortawesome/free-solid-svg-icons": "^5.15.2",
65    "@fortawesome/react-fontawesome": "^0.1.14",
66    "@fullcalendar/bootstrap": "^5.5.0",
67    "@fullcalendar/core": "^5.5.0",
68    "@fullcalendar/daygrid": "^5.5.0",
69    "@fullcalendar/interaction": "^5.5.0",
70    "@fullcalendar/react": "^5.5.0",
71    "@lourenci/react-kanban": "^2.1.0",
72    "@redux-saga/simple-saga-monitor": "^1.1.2",
73    "@testing-library/jest-dom": "^5.11.9",
74    "@testing-library/react": "^11.2.3",
75    "@testing-library/user-event": "^12.6.0",
76    "@toast-ui/react-chart": "^1.0.2",
77    "@types/jest": "^26.0.14",
78    "@types/node": "^14.10.3",
79    "@types/react": "^16.9.49",
80    "@types/react-dom": "^16.9.8",
81    "@vtaits/react-color-picker": "^0.1.1",
82    "apexcharts": "^3.23.1",
83    "availity-reactstrap-validation": "^2.7.0",
84    "axios": "^0.21.1",
85    "axios-mock-adapter": "^1.19.0",
86    "axios-progress-bar": "^1.2.0",
87    "bootstrap": "^5.0.0-beta2",
88    "chart.js": "^2.9.4",
89    "chartist": "^0.11.4",
90    "classnames": "^2.2.6",
91    "components": "^0.1.0",
92    "dotenv": "^8.2.0",
93    "draft-js": "^0.11.7",
94    "echarts": "^4.9.0",
95    "echarts-for-react": "^2.0.16",
96    "firebase": "^8.2.3",
97    "google-maps-react": "^2.0.6",
98    "history": "^4.10.1",
99    "i": "^0.3.6",
100    "i18next": "^19.8.4",
101    "i18next-browser-languagedetector": "^6.0.1",
102    "jsonwebtoken": "^8.5.1",
103    "leaflet": "^1.7.1",
104    "lodash": "^4.17.21",
105    "lodash.clonedeep": "^4.5.0",
106    "lodash.get": "^4.4.2",
107    "metismenujs": "^1.2.1",
108    "mkdirp": "^1.0.4",
109    "moment": "2.29.1",
110    "moment-timezone": "^0.5.32",
111    "nouislider-react": "^3.3.9",
112    "npm": "^7.6.3",
113    "prop-types": "^15.7.2",
114    "query-string": "^6.14.0",
115    "react": "^16.13.1",
116    "react-apexcharts": "^1.3.7",
117    "react-auth-code-input": "^1.0.0",
118    "react-avatar": "^3.10.0",
119    "react-bootstrap": "^1.5.0",
120    "react-bootstrap-editable": "^0.8.2",
121    "react-bootstrap-sweetalert": "^5.2.0",
122    "react-bootstrap-table-next": "^4.0.3",
123    "react-bootstrap-table2-editor": "^1.4.0",
124    "react-bootstrap-table2-paginator": "^2.1.2",
125    "react-bootstrap-table2-toolkit": "^2.1.3",
126    "react-chartist": "^0.14.3",
127    "react-chartjs-2": "^2.11.1",
128    "react-color": "^2.19.3",
129    "react-confirm-alert": "^2.7.0",
130    "react-content-loader": "^6.0.1",
131    "react-countdown": "^2.3.1",
132    "react-countup": "^4.3.3",
133    "react-cropper": "^2.1.4",
134    "react-data-table-component": "^6.11.8",
135    "react-date-picker": "^8.0.6",
136    "react-datepicker": "^3.4.1",
137    "react-dom": "^16.13.1",
138    "react-draft-wysiwyg": "^1.14.5",
139    "react-drag-listview": "^0.1.8",
140    "react-drawer": "^1.3.4",
141    "react-dropzone": "^11.2.4",
142    "react-dual-listbox": "^2.0.0",
143    "react-facebook-login": "^4.1.1",
144    "react-flatpickr": "^3.10.6",
145    "react-google-login": "^5.2.2",
146    "react-hook-form": "^7.15.2",
147    "react-i18next": "^11.8.5",
148    "react-icons": "^4.2.0",
149    "react-image-lightbox": "^5.1.1",
150    "react-input-mask": "^2.0.4",
151    "react-jvectormap": "^0.0.16",
152    "react-leaflet": "^3.0.5",
153    "react-meta-tags": "^1.0.1",
154    "react-modal-video": "^1.2.6",
155    "react-notifications": "^1.7.2",
156    "react-number-format": "^4.7.3",
157    "react-perfect-scrollbar": "^1.5.8",
158    "react-rangeslider": "^2.2.0",
159    "react-rating": "^2.0.5",
160    "react-rating-tooltip": "^1.1.6",
161    "react-redux": "^7.2.1",
162    "react-responsive-carousel": "^3.2.11",
163    "react-router-dom": "^5.2.0",
164    "react-script": "^2.0.5",
165    "react-scripts": "3.4.3",
166    "react-select": "^4.3.1",
167    "react-sparklines": "^1.7.0",
168    "react-star-ratings": "^2.3.0",
169    "react-super-responsive-table": "^5.2.0",
170    "react-switch": "^6.0.0",
171    "react-table": "^7.6.3",
172    "react-toastify": "^7.0.3",
173    "react-toastr": "^3.0.0",
174    "react-twitter-auth": "0.0.13",
175    "reactstrap": "^8.8.1",
176    "recharts": "^2.0.8",
177    "redux": "^4.0.5",
178    "redux-saga": "^1.1.3",
179    "reselect": "^4.0.0",
180    "sass": "^1.37.5",
181    "simplebar-react": "^2.3.0",
182    "styled": "^1.0.0",
183    "styled-components": "^5.2.1",
184    "toastr": "^2.1.4",
185    "typescript": "^4.0.2",
186    "universal-cookie": "^4.0.4"
187  },
188  "devDependencies": {
189    "@typescript-eslint/eslint-plugin": "^2.27.0",
190    "@typescript-eslint/parser": "^2.27.0",
191    "@typescript-eslint/typescript-estree": "^4.15.2",
192    "eslint-config-prettier": "^6.10.1",
193    "eslint-plugin-prettier": "^3.1.2",
194    "husky": "^4.2.5",
195    "lint-staged": "^10.1.3",
196    "prettier": "^1.19.1",
197    "react-test-renderer": "^16.13.1",
198    "redux-devtools-extension": "^2.13.8",
199    "redux-mock-store": "^1.5.4"
200  },
201  "scripts": {
202    "start": "react-scripts start",
203    "build": "react-scripts build && mv build ./deploy/build",
204    "build-local": "react-scripts build",
205    "test": "react-scripts test",
206    "eject": "react-scripts eject"
207  },
208  "eslintConfig": {
209    "extends": "react-app"
210  },
211  "husky": {
212    "hooks": {
213      "pre-commit": "lint-staged"
214    }
215  },
216  "lint-staged": {
217    "*.{js,ts,tsx}": [
218      "eslint --fix"
219    ]
220  },
221  "browserslist": {
222    "production": [
223      ">0.2%",
224      "not dead",
225      "not op_mini all"
226    ],
227    "development": [
228      "last 1 chrome version",
229      "last 1 firefox version",
230      "last 1 safari version"
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig
236git config --global url."https://github.com/".insteadOf git://github.com/
237

You can also use SSH, but GitHub Security reminds us that, as of March 15th, 2022, GitHub stopped accepting DSA keys. RSA keys uploaded after Nov 2, 2021 will work only with SHA-2 signatures.
The deprecated MACs, ciphers, and unencrypted Git protocol are permanently disabled.

So this (with the right key) would work:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  "name": "stackstream-fe",
57  "version": "1.0.0",
58  "authors": [
59    "fayyaznofal@gmail.com"
60  ],
61  "private": true,
62  "dependencies": {
63    "@fortawesome/fontawesome-svg-core": "^1.2.34",
64    "@fortawesome/free-solid-svg-icons": "^5.15.2",
65    "@fortawesome/react-fontawesome": "^0.1.14",
66    "@fullcalendar/bootstrap": "^5.5.0",
67    "@fullcalendar/core": "^5.5.0",
68    "@fullcalendar/daygrid": "^5.5.0",
69    "@fullcalendar/interaction": "^5.5.0",
70    "@fullcalendar/react": "^5.5.0",
71    "@lourenci/react-kanban": "^2.1.0",
72    "@redux-saga/simple-saga-monitor": "^1.1.2",
73    "@testing-library/jest-dom": "^5.11.9",
74    "@testing-library/react": "^11.2.3",
75    "@testing-library/user-event": "^12.6.0",
76    "@toast-ui/react-chart": "^1.0.2",
77    "@types/jest": "^26.0.14",
78    "@types/node": "^14.10.3",
79    "@types/react": "^16.9.49",
80    "@types/react-dom": "^16.9.8",
81    "@vtaits/react-color-picker": "^0.1.1",
82    "apexcharts": "^3.23.1",
83    "availity-reactstrap-validation": "^2.7.0",
84    "axios": "^0.21.1",
85    "axios-mock-adapter": "^1.19.0",
86    "axios-progress-bar": "^1.2.0",
87    "bootstrap": "^5.0.0-beta2",
88    "chart.js": "^2.9.4",
89    "chartist": "^0.11.4",
90    "classnames": "^2.2.6",
91    "components": "^0.1.0",
92    "dotenv": "^8.2.0",
93    "draft-js": "^0.11.7",
94    "echarts": "^4.9.0",
95    "echarts-for-react": "^2.0.16",
96    "firebase": "^8.2.3",
97    "google-maps-react": "^2.0.6",
98    "history": "^4.10.1",
99    "i": "^0.3.6",
100    "i18next": "^19.8.4",
101    "i18next-browser-languagedetector": "^6.0.1",
102    "jsonwebtoken": "^8.5.1",
103    "leaflet": "^1.7.1",
104    "lodash": "^4.17.21",
105    "lodash.clonedeep": "^4.5.0",
106    "lodash.get": "^4.4.2",
107    "metismenujs": "^1.2.1",
108    "mkdirp": "^1.0.4",
109    "moment": "2.29.1",
110    "moment-timezone": "^0.5.32",
111    "nouislider-react": "^3.3.9",
112    "npm": "^7.6.3",
113    "prop-types": "^15.7.2",
114    "query-string": "^6.14.0",
115    "react": "^16.13.1",
116    "react-apexcharts": "^1.3.7",
117    "react-auth-code-input": "^1.0.0",
118    "react-avatar": "^3.10.0",
119    "react-bootstrap": "^1.5.0",
120    "react-bootstrap-editable": "^0.8.2",
121    "react-bootstrap-sweetalert": "^5.2.0",
122    "react-bootstrap-table-next": "^4.0.3",
123    "react-bootstrap-table2-editor": "^1.4.0",
124    "react-bootstrap-table2-paginator": "^2.1.2",
125    "react-bootstrap-table2-toolkit": "^2.1.3",
126    "react-chartist": "^0.14.3",
127    "react-chartjs-2": "^2.11.1",
128    "react-color": "^2.19.3",
129    "react-confirm-alert": "^2.7.0",
130    "react-content-loader": "^6.0.1",
131    "react-countdown": "^2.3.1",
132    "react-countup": "^4.3.3",
133    "react-cropper": "^2.1.4",
134    "react-data-table-component": "^6.11.8",
135    "react-date-picker": "^8.0.6",
136    "react-datepicker": "^3.4.1",
137    "react-dom": "^16.13.1",
138    "react-draft-wysiwyg": "^1.14.5",
139    "react-drag-listview": "^0.1.8",
140    "react-drawer": "^1.3.4",
141    "react-dropzone": "^11.2.4",
142    "react-dual-listbox": "^2.0.0",
143    "react-facebook-login": "^4.1.1",
144    "react-flatpickr": "^3.10.6",
145    "react-google-login": "^5.2.2",
146    "react-hook-form": "^7.15.2",
147    "react-i18next": "^11.8.5",
148    "react-icons": "^4.2.0",
149    "react-image-lightbox": "^5.1.1",
150    "react-input-mask": "^2.0.4",
151    "react-jvectormap": "^0.0.16",
152    "react-leaflet": "^3.0.5",
153    "react-meta-tags": "^1.0.1",
154    "react-modal-video": "^1.2.6",
155    "react-notifications": "^1.7.2",
156    "react-number-format": "^4.7.3",
157    "react-perfect-scrollbar": "^1.5.8",
158    "react-rangeslider": "^2.2.0",
159    "react-rating": "^2.0.5",
160    "react-rating-tooltip": "^1.1.6",
161    "react-redux": "^7.2.1",
162    "react-responsive-carousel": "^3.2.11",
163    "react-router-dom": "^5.2.0",
164    "react-script": "^2.0.5",
165    "react-scripts": "3.4.3",
166    "react-select": "^4.3.1",
167    "react-sparklines": "^1.7.0",
168    "react-star-ratings": "^2.3.0",
169    "react-super-responsive-table": "^5.2.0",
170    "react-switch": "^6.0.0",
171    "react-table": "^7.6.3",
172    "react-toastify": "^7.0.3",
173    "react-toastr": "^3.0.0",
174    "react-twitter-auth": "0.0.13",
175    "reactstrap": "^8.8.1",
176    "recharts": "^2.0.8",
177    "redux": "^4.0.5",
178    "redux-saga": "^1.1.3",
179    "reselect": "^4.0.0",
180    "sass": "^1.37.5",
181    "simplebar-react": "^2.3.0",
182    "styled": "^1.0.0",
183    "styled-components": "^5.2.1",
184    "toastr": "^2.1.4",
185    "typescript": "^4.0.2",
186    "universal-cookie": "^4.0.4"
187  },
188  "devDependencies": {
189    "@typescript-eslint/eslint-plugin": "^2.27.0",
190    "@typescript-eslint/parser": "^2.27.0",
191    "@typescript-eslint/typescript-estree": "^4.15.2",
192    "eslint-config-prettier": "^6.10.1",
193    "eslint-plugin-prettier": "^3.1.2",
194    "husky": "^4.2.5",
195    "lint-staged": "^10.1.3",
196    "prettier": "^1.19.1",
197    "react-test-renderer": "^16.13.1",
198    "redux-devtools-extension": "^2.13.8",
199    "redux-mock-store": "^1.5.4"
200  },
201  "scripts": {
202    "start": "react-scripts start",
203    "build": "react-scripts build && mv build ./deploy/build",
204    "build-local": "react-scripts build",
205    "test": "react-scripts test",
206    "eject": "react-scripts eject"
207  },
208  "eslintConfig": {
209    "extends": "react-app"
210  },
211  "husky": {
212    "hooks": {
213      "pre-commit": "lint-staged"
214    }
215  },
216  "lint-staged": {
217    "*.{js,ts,tsx}": [
218      "eslint --fix"
219    ]
220  },
221  "browserslist": {
222    "production": [
223      ">0.2%",
224      "not dead",
225      "not op_mini all"
226    ],
227    "development": [
228      "last 1 chrome version",
229      "last 1 firefox version",
230      "last 1 safari version"
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig
236git config --global url."https://github.com/".insteadOf git://github.com/
237git config --global url."git@github.com:".insteadOf git://github.com/
238

That will change any git://github.com/ (unencrypted Git protocol) into git@github.com: (SSH URL).

Source https://stackoverflow.com/questions/70663523

QUESTION

in Typescript, try...catch error object shows "Object is of type 'unknown'.ts(2571)"

Asked 2022-Mar-18 at 03:47
1router.get('/cells', async (req, res) => {
2    try {
3      const result = await fs.readFile(fullPath, { encoding: 'utf-8' });
4      res.send(JSON.parse(result));
5    } catch (err) {
6      if (err.code === 'ENOENT') { // Object is of type 'unknown'.ts(2571) (local var) err: unknown
7        await fs.writeFile(fullPath, '[]', 'utf-8');
8        res.send([]);
9      } else {
10        throw err;
11      }
12    }
13

err.code make this ts error : Object is of type 'unknown'.ts(2571)

I definitely know that err.code exists, so I want to know how to define the type(or interface) of err?

(tsc version info : My global typescript version is v4.3.5 and the above code belongs to my project which has typescript v4.1.2)

--- Edit ---

I finally know why this error happens to me. I thought I used tsc version under 4.3.x, but it turns out I used v4.4.x.

In vscode, cmd + shift + P and search for Select Typescript version and I actually used v4.4.3, (I mistakenly thought on version because I only check tsc version from terminal)

enter image description here

enter image description here

Thanks for sharing Youtube video,

ANSWER

Answered 2021-Oct-03 at 06:44

In JavaScript/TypeScript you can throw anything, not only errors. In theory it could be anything in the catch block. If you want to prevent the type error it could make sense to check if the unknown value is a system error before checking the code.

1router.get('/cells', async (req, res) => {
2    try {
3      const result = await fs.readFile(fullPath, { encoding: 'utf-8' });
4      res.send(JSON.parse(result));
5    } catch (err) {
6      if (err.code === 'ENOENT') { // Object is of type 'unknown'.ts(2571) (local var) err: unknown
7        await fs.writeFile(fullPath, '[]', 'utf-8');
8        res.send([]);
9      } else {
10        throw err;
11      }
12    }
13if (err instanceof SystemError && err.code === 'ENOENT') {
14  // file not found
15}
16

Source https://stackoverflow.com/questions/69422525

QUESTION

Uncaught ReferenceError: Buffer is not defined

Asked 2022-Mar-17 at 15:41

Our application kept showing the error in the title. The problem is very likely related to Webpack 5 polyfill and after going through a couple of solutions:

  1. Setting fallback + install with npm
1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5
  1. Setting alias
1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5alias: {
6  "buffer": "buffer",
7  "stream": "stream-browserify"
8}
9

We are still seeing the dreadful error:

1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5alias: {
6  "buffer": "buffer",
7  "stream": "stream-browserify"
8}
9rfc6979.js:3 Uncaught ReferenceError: Buffer is not defined
10    at Object.4142 (rfc6979.js:3)
11    at r (bootstrap:19)
12    at Object.5892 (js.js:4)
13    at r (bootstrap:19)
14    at Object.4090 (bip32.js:5)
15    at r (bootstrap:19)
16    at Object.7786 (index.js:3)
17    at r (bootstrap:19)
18    at Object.1649 (MnemonicKey.js:50)
19    at r (bootstrap:19)
20

Our setup is vanilla NodeJS + TypeScript + Webpack for multi-target: node + browser. Any help would be great!

ANSWER

Answered 2021-Aug-10 at 08:15

Answering my own question. Two things helped to resolve the issue:

  1. Adding plugins section with ProviderPlugin into webpack.config.js
1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5alias: {
6  "buffer": "buffer",
7  "stream": "stream-browserify"
8}
9rfc6979.js:3 Uncaught ReferenceError: Buffer is not defined
10    at Object.4142 (rfc6979.js:3)
11    at r (bootstrap:19)
12    at Object.5892 (js.js:4)
13    at r (bootstrap:19)
14    at Object.4090 (bip32.js:5)
15    at r (bootstrap:19)
16    at Object.7786 (index.js:3)
17    at r (bootstrap:19)
18    at Object.1649 (MnemonicKey.js:50)
19    at r (bootstrap:19)
20const webpack = require('webpack');
21
22module.exports = {
23    // ...
24
25    plugins: [
26        // Work around for Buffer is undefined:
27        // https://github.com/webpack/changelog-v5/issues/10
28        new webpack.ProvidePlugin({
29            Buffer: ['buffer', 'Buffer'],
30        }),
31        new webpack.ProvidePlugin({
32            process: 'process/browser',
33        }),
34    ],
35
36
  1. Also add in resolve.fallback into webpack.config.js:
1fallback: {
2  "stream": require.resolve("stream-browserify"),
3  "buffer": require.resolve("buffer/")
4}
5alias: {
6  "buffer": "buffer",
7  "stream": "stream-browserify"
8}
9rfc6979.js:3 Uncaught ReferenceError: Buffer is not defined
10    at Object.4142 (rfc6979.js:3)
11    at r (bootstrap:19)
12    at Object.5892 (js.js:4)
13    at r (bootstrap:19)
14    at Object.4090 (bip32.js:5)
15    at r (bootstrap:19)
16    at Object.7786 (index.js:3)
17    at r (bootstrap:19)
18    at Object.1649 (MnemonicKey.js:50)
19    at r (bootstrap:19)
20const webpack = require('webpack');
21
22module.exports = {
23    // ...
24
25    plugins: [
26        // Work around for Buffer is undefined:
27        // https://github.com/webpack/changelog-v5/issues/10
28        new webpack.ProvidePlugin({
29            Buffer: ['buffer', 'Buffer'],
30        }),
31        new webpack.ProvidePlugin({
32            process: 'process/browser',
33        }),
34    ],
35
36    resolve: {
37        extensions: [ '.ts', '.js' ],
38        fallback: {
39            "stream": require.resolve("stream-browserify"),
40            "buffer": require.resolve("buffer")
41        }
42    },
43
44

Source https://stackoverflow.com/questions/68707553

QUESTION

ESlint - Error: Must use import to load ES Module

Asked 2022-Mar-17 at 12:13

I am currently setting up a boilerplate with React, Typescript, styled components, webpack etc. and I am getting an error when trying to run eslint:

Error: Must use import to load ES Module

Here is a more verbose version of the error:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6

The error occurs in every single one of my .js and .ts/ .tsx files where I only use import or the file doesn't even have an import at all. I understand what the error is saying but I have no idea why it is being thrown when in fact I only use imports or even no imports at all in some files.

Here is my package.json where I trigger the linter from using npm run lint:eslint:quiet:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  "name": "my-react-boilerplate",
8  "version": "1.0.0",
9  "description": "",
10  "main": "index.tsx",
11  "directories": {
12    "test": "test"
13  },
14  "engines": {
15    "node": ">=14.0.0"
16  },
17  "type": "module",
18  "scripts": {
19    "build": "webpack --config webpack.prod.js",
20    "dev": "webpack serve --config webpack.dev.js",
21    "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22    "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23    "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet",
24    "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern",
25    "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix",
26    "test": "cross-env NODE_ENV=test jest --coverage",
27    "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28    "typecheck": "tsc --noEmit",
29    "precommit": "npm run lint"
30  },
31  "lint-staged": {
32    "*.{ts,tsx,js,jsx}": [
33      "npm run lint:eslint:fix",
34      "git add --force"
35    ],
36    "*.{md,json}": [
37      "prettier --write",
38      "git add --force"
39    ]
40  },
41  "husky": {
42    "hooks": {
43      "pre-commit": "npx lint-staged && npm run typecheck"
44    }
45  },
46  "resolutions": {
47    "styled-components": "^5"
48  },
49  "author": "",
50  "license": "ISC",
51  "devDependencies": {
52    "@babel/core": "^7.5.4",
53    "@babel/plugin-proposal-class-properties": "^7.5.0",
54    "@babel/preset-env": "^7.5.4",
55    "@babel/preset-react": "^7.0.0",
56    "@types/history": "^4.7.6",
57    "@types/react": "^17.0.29",
58    "@types/react-dom": "^17.0.9",
59    "@types/react-router": "^5.1.17",
60    "@types/react-router-dom": "^5.1.5",
61    "@types/styled-components": "^5.1.15",
62    "@typescript-eslint/eslint-plugin": "^5.0.0",
63    "babel-cli": "^6.26.0",
64    "babel-eslint": "^10.0.2",
65    "babel-loader": "^8.0.0-beta.6",
66    "babel-polyfill": "^6.26.0",
67    "babel-preset-env": "^1.7.0",
68    "babel-preset-react": "^6.24.1",
69    "babel-preset-stage-2": "^6.24.1",
70    "clean-webpack-plugin": "^4.0.0",
71    "dotenv-webpack": "^7.0.3",
72    "error-overlay-webpack-plugin": "^1.0.0",
73    "eslint": "^8.0.0",
74    "eslint-config-airbnb": "^18.2.0",
75    "eslint-config-prettier": "^8.3.0",
76    "eslint-config-with-prettier": "^6.0.0",
77    "eslint-plugin-compat": "^3.3.0",
78    "eslint-plugin-import": "^2.25.2",
79    "eslint-plugin-jsx-a11y": "^6.2.3",
80    "eslint-plugin-prettier": "^4.0.0",
81    "eslint-plugin-react": "^7.14.2",
82    "eslint-plugin-react-hooks": "^4.2.0",
83    "extract-text-webpack-plugin": "^3.0.2",
84    "file-loader": "^6.2.0",
85    "html-webpack-plugin": "^5.3.2",
86    "husky": "^7.0.2",
87    "prettier": "^2.4.1",
88    "raw-loader": "^4.0.2",
89    "style-loader": "^3.3.0",
90    "stylelint": "^13.13.1",
91    "stylelint-config-recommended": "^5.0.0",
92    "stylelint-config-styled-components": "^0.1.1",
93    "stylelint-processor-styled-components": "^1.10.0",
94    "ts-loader": "^9.2.6",
95    "tslint": "^6.1.3",
96    "typescript": "^4.4.4",
97    "url-loader": "^4.1.1",
98    "webpack": "^5.58.2",
99    "webpack-cli": "^4.2.0",
100    "webpack-dev-server": "^4.3.1",
101    "webpack-merge": "^5.3.0"
102  },
103  "dependencies": {
104    "history": "^4.10.0",
105    "process": "^0.11.10",
106    "react": "^17.0.1",
107    "react-dom": "^17.0.1",
108    "react-router-dom": "^5.2.0",
109    "styled-components": "^5.2.1"
110  }
111}
112

Here is my .eslintrc file:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  "name": "my-react-boilerplate",
8  "version": "1.0.0",
9  "description": "",
10  "main": "index.tsx",
11  "directories": {
12    "test": "test"
13  },
14  "engines": {
15    "node": ">=14.0.0"
16  },
17  "type": "module",
18  "scripts": {
19    "build": "webpack --config webpack.prod.js",
20    "dev": "webpack serve --config webpack.dev.js",
21    "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22    "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23    "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet",
24    "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern",
25    "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix",
26    "test": "cross-env NODE_ENV=test jest --coverage",
27    "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28    "typecheck": "tsc --noEmit",
29    "precommit": "npm run lint"
30  },
31  "lint-staged": {
32    "*.{ts,tsx,js,jsx}": [
33      "npm run lint:eslint:fix",
34      "git add --force"
35    ],
36    "*.{md,json}": [
37      "prettier --write",
38      "git add --force"
39    ]
40  },
41  "husky": {
42    "hooks": {
43      "pre-commit": "npx lint-staged && npm run typecheck"
44    }
45  },
46  "resolutions": {
47    "styled-components": "^5"
48  },
49  "author": "",
50  "license": "ISC",
51  "devDependencies": {
52    "@babel/core": "^7.5.4",
53    "@babel/plugin-proposal-class-properties": "^7.5.0",
54    "@babel/preset-env": "^7.5.4",
55    "@babel/preset-react": "^7.0.0",
56    "@types/history": "^4.7.6",
57    "@types/react": "^17.0.29",
58    "@types/react-dom": "^17.0.9",
59    "@types/react-router": "^5.1.17",
60    "@types/react-router-dom": "^5.1.5",
61    "@types/styled-components": "^5.1.15",
62    "@typescript-eslint/eslint-plugin": "^5.0.0",
63    "babel-cli": "^6.26.0",
64    "babel-eslint": "^10.0.2",
65    "babel-loader": "^8.0.0-beta.6",
66    "babel-polyfill": "^6.26.0",
67    "babel-preset-env": "^1.7.0",
68    "babel-preset-react": "^6.24.1",
69    "babel-preset-stage-2": "^6.24.1",
70    "clean-webpack-plugin": "^4.0.0",
71    "dotenv-webpack": "^7.0.3",
72    "error-overlay-webpack-plugin": "^1.0.0",
73    "eslint": "^8.0.0",
74    "eslint-config-airbnb": "^18.2.0",
75    "eslint-config-prettier": "^8.3.0",
76    "eslint-config-with-prettier": "^6.0.0",
77    "eslint-plugin-compat": "^3.3.0",
78    "eslint-plugin-import": "^2.25.2",
79    "eslint-plugin-jsx-a11y": "^6.2.3",
80    "eslint-plugin-prettier": "^4.0.0",
81    "eslint-plugin-react": "^7.14.2",
82    "eslint-plugin-react-hooks": "^4.2.0",
83    "extract-text-webpack-plugin": "^3.0.2",
84    "file-loader": "^6.2.0",
85    "html-webpack-plugin": "^5.3.2",
86    "husky": "^7.0.2",
87    "prettier": "^2.4.1",
88    "raw-loader": "^4.0.2",
89    "style-loader": "^3.3.0",
90    "stylelint": "^13.13.1",
91    "stylelint-config-recommended": "^5.0.0",
92    "stylelint-config-styled-components": "^0.1.1",
93    "stylelint-processor-styled-components": "^1.10.0",
94    "ts-loader": "^9.2.6",
95    "tslint": "^6.1.3",
96    "typescript": "^4.4.4",
97    "url-loader": "^4.1.1",
98    "webpack": "^5.58.2",
99    "webpack-cli": "^4.2.0",
100    "webpack-dev-server": "^4.3.1",
101    "webpack-merge": "^5.3.0"
102  },
103  "dependencies": {
104    "history": "^4.10.0",
105    "process": "^0.11.10",
106    "react": "^17.0.1",
107    "react-dom": "^17.0.1",
108    "react-router-dom": "^5.2.0",
109    "styled-components": "^5.2.1"
110  }
111}
112{
113  "extends": ["airbnb", "prettier"],
114  "parser": "babel-eslint",
115  "plugins": ["prettier", "@typescript-eslint"],
116  "parserOptions": {
117    "ecmaVersion": 8,
118    "ecmaFeatures": {
119      "experimentalObjectRestSpread": true,
120      "impliedStrict": true,
121      "classes": true
122    }
123  },
124  "env": {
125    "browser": true,
126    "node": true,
127    "jest": true
128  },
129  "rules": {
130    "arrow-body-style": ["error", "as-needed"],
131    "class-methods-use-this": 0,
132    "react/jsx-filename-extension": 0,
133    "global-require": 0,
134    "react/destructuring-assignment": 0,
135    "import/named": 2,
136    "linebreak-style": 0,
137    "import/no-dynamic-require": 0,
138    "import/no-named-as-default": 0,
139    "import/no-unresolved": 2,
140    "import/prefer-default-export": 0,
141    "semi": [2, "always"],
142    "max-len": [
143      "error",
144      {
145        "code": 80,
146        "ignoreUrls": true,
147        "ignoreComments": true,
148        "ignoreStrings": true,
149        "ignoreTemplateLiterals": true
150      }
151    ],
152    "new-cap": [
153      2,
154      {
155        "capIsNew": false,
156        "newIsCap": true
157      }
158    ],
159    "no-param-reassign": 0,
160    "no-shadow": 0,
161    "no-tabs": 2,
162    "no-underscore-dangle": 0,
163    "react/forbid-prop-types": [
164      "error",
165      {
166        "forbid": ["any"]
167      }
168    ],
169    "import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
170    "react/jsx-no-bind": [
171      "error",
172      {
173        "ignoreRefs": true,
174        "allowArrowFunctions": true,
175        "allowBind": false
176      }
177    ],
178    "react/no-unknown-property": [
179      2,
180      {
181        "ignore": ["itemscope", "itemtype", "itemprop"]
182      }
183    ]
184  }
185}
186

And i'm not sure if relevant but also my tsconfig.eslint.json file:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  "name": "my-react-boilerplate",
8  "version": "1.0.0",
9  "description": "",
10  "main": "index.tsx",
11  "directories": {
12    "test": "test"
13  },
14  "engines": {
15    "node": ">=14.0.0"
16  },
17  "type": "module",
18  "scripts": {
19    "build": "webpack --config webpack.prod.js",
20    "dev": "webpack serve --config webpack.dev.js",
21    "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22    "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23    "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet",
24    "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern",
25    "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix",
26    "test": "cross-env NODE_ENV=test jest --coverage",
27    "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28    "typecheck": "tsc --noEmit",
29    "precommit": "npm run lint"
30  },
31  "lint-staged": {
32    "*.{ts,tsx,js,jsx}": [
33      "npm run lint:eslint:fix",
34      "git add --force"
35    ],
36    "*.{md,json}": [
37      "prettier --write",
38      "git add --force"
39    ]
40  },
41  "husky": {
42    "hooks": {
43      "pre-commit": "npx lint-staged && npm run typecheck"
44    }
45  },
46  "resolutions": {
47    "styled-components": "^5"
48  },
49  "author": "",
50  "license": "ISC",
51  "devDependencies": {
52    "@babel/core": "^7.5.4",
53    "@babel/plugin-proposal-class-properties": "^7.5.0",
54    "@babel/preset-env": "^7.5.4",
55    "@babel/preset-react": "^7.0.0",
56    "@types/history": "^4.7.6",
57    "@types/react": "^17.0.29",
58    "@types/react-dom": "^17.0.9",
59    "@types/react-router": "^5.1.17",
60    "@types/react-router-dom": "^5.1.5",
61    "@types/styled-components": "^5.1.15",
62    "@typescript-eslint/eslint-plugin": "^5.0.0",
63    "babel-cli": "^6.26.0",
64    "babel-eslint": "^10.0.2",
65    "babel-loader": "^8.0.0-beta.6",
66    "babel-polyfill": "^6.26.0",
67    "babel-preset-env": "^1.7.0",
68    "babel-preset-react": "^6.24.1",
69    "babel-preset-stage-2": "^6.24.1",
70    "clean-webpack-plugin": "^4.0.0",
71    "dotenv-webpack": "^7.0.3",
72    "error-overlay-webpack-plugin": "^1.0.0",
73    "eslint": "^8.0.0",
74    "eslint-config-airbnb": "^18.2.0",
75    "eslint-config-prettier": "^8.3.0",
76    "eslint-config-with-prettier": "^6.0.0",
77    "eslint-plugin-compat": "^3.3.0",
78    "eslint-plugin-import": "^2.25.2",
79    "eslint-plugin-jsx-a11y": "^6.2.3",
80    "eslint-plugin-prettier": "^4.0.0",
81    "eslint-plugin-react": "^7.14.2",
82    "eslint-plugin-react-hooks": "^4.2.0",
83    "extract-text-webpack-plugin": "^3.0.2",
84    "file-loader": "^6.2.0",
85    "html-webpack-plugin": "^5.3.2",
86    "husky": "^7.0.2",
87    "prettier": "^2.4.1",
88    "raw-loader": "^4.0.2",
89    "style-loader": "^3.3.0",
90    "stylelint": "^13.13.1",
91    "stylelint-config-recommended": "^5.0.0",
92    "stylelint-config-styled-components": "^0.1.1",
93    "stylelint-processor-styled-components": "^1.10.0",
94    "ts-loader": "^9.2.6",
95    "tslint": "^6.1.3",
96    "typescript": "^4.4.4",
97    "url-loader": "^4.1.1",
98    "webpack": "^5.58.2",
99    "webpack-cli": "^4.2.0",
100    "webpack-dev-server": "^4.3.1",
101    "webpack-merge": "^5.3.0"
102  },
103  "dependencies": {
104    "history": "^4.10.0",
105    "process": "^0.11.10",
106    "react": "^17.0.1",
107    "react-dom": "^17.0.1",
108    "react-router-dom": "^5.2.0",
109    "styled-components": "^5.2.1"
110  }
111}
112{
113  "extends": ["airbnb", "prettier"],
114  "parser": "babel-eslint",
115  "plugins": ["prettier", "@typescript-eslint"],
116  "parserOptions": {
117    "ecmaVersion": 8,
118    "ecmaFeatures": {
119      "experimentalObjectRestSpread": true,
120      "impliedStrict": true,
121      "classes": true
122    }
123  },
124  "env": {
125    "browser": true,
126    "node": true,
127    "jest": true
128  },
129  "rules": {
130    "arrow-body-style": ["error", "as-needed"],
131    "class-methods-use-this": 0,
132    "react/jsx-filename-extension": 0,
133    "global-require": 0,
134    "react/destructuring-assignment": 0,
135    "import/named": 2,
136    "linebreak-style": 0,
137    "import/no-dynamic-require": 0,
138    "import/no-named-as-default": 0,
139    "import/no-unresolved": 2,
140    "import/prefer-default-export": 0,
141    "semi": [2, "always"],
142    "max-len": [
143      "error",
144      {
145        "code": 80,
146        "ignoreUrls": true,
147        "ignoreComments": true,
148        "ignoreStrings": true,
149        "ignoreTemplateLiterals": true
150      }
151    ],
152    "new-cap": [
153      2,
154      {
155        "capIsNew": false,
156        "newIsCap": true
157      }
158    ],
159    "no-param-reassign": 0,
160    "no-shadow": 0,
161    "no-tabs": 2,
162    "no-underscore-dangle": 0,
163    "react/forbid-prop-types": [
164      "error",
165      {
166        "forbid": ["any"]
167      }
168    ],
169    "import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
170    "react/jsx-no-bind": [
171      "error",
172      {
173        "ignoreRefs": true,
174        "allowArrowFunctions": true,
175        "allowBind": false
176      }
177    ],
178    "react/no-unknown-property": [
179      2,
180      {
181        "ignore": ["itemscope", "itemtype", "itemprop"]
182      }
183    ]
184  }
185}
186{
187  "extends": "./tsconfig.json",
188  "include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.js"],
189  "exclude": ["node_modules/**", "build/**", "coverage/**"]
190}
191

Not sure if anyone has come across this before? Googling the error does not present any useful forums or raised bugs, most of them just state not to use require in your files which I am not.

ANSWER

Answered 2022-Mar-15 at 16:08

I think the problem is that you are trying to use the deprecated babel-eslint parser, last updated a year ago, which looks like it doesn't support ES6 modules. Updating to the latest parser seems to work, at least for simple linting.

So, do this:

  • In package.json, update the line "babel-eslint": "^10.0.2", to "@babel/eslint-parser": "^7.5.4",. This works with the code above but it may be better to use the latest version, which at the time of writing is 7.16.3.
  • Run npm i from a terminal/command prompt in the folder
  • In .eslintrc, update the parser line "parser": "babel-eslint", to "parser": "@babel/eslint-parser",
  • In .eslintrc, add "requireConfigFile": false, to the parserOptions section (underneath "ecmaVersion": 8,) (I needed this or babel was looking for config files I don't have)
  • Run the command to lint a file

Then, for me with just your two configuration files, the error goes away and I get appropriate linting errors.

Source https://stackoverflow.com/questions/69554485

QUESTION

npx create-react-app prompting to globally uninstall non-existent create-react-app package?

Asked 2022-Feb-19 at 03:11

I am having problems with npx create-react-app involving global installs. My confusion arises because as far as I'm aware the create-react-app package is not installed on my machine.

Some Details:

I start a react project (with typescript template) as I have previously and recently done on this same machine a number of times:

npx create-react-app --template typescript .

I get this prompt from the terminal

Need to install the following packages: create-react-app Ok to proceed? (y)

I press y to confirm it's okay to proceed. (If I press n, the process terminates with the following error: npm ERR! canceled.) The terminal then displays the following message

1You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
2
3We no longer support global installation of Create React App.
4
5Please remove any global installs with one of the following commands:
6- npm uninstall -g create-react-app
7- yarn global remove create-react-app
8
9The latest instructions for creating a new app can be found here:
10https://create-react-app.dev/docs/getting-started/
11

I run both suggested commands to uninstall create-react-app globally. npm goes smoothly:

1You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
2
3We no longer support global installation of Create React App.
4
5Please remove any global installs with one of the following commands:
6- npm uninstall -g create-react-app
7- yarn global remove create-react-app
8
9The latest instructions for creating a new app can be found here:
10https://create-react-app.dev/docs/getting-started/
11
12npm uninstall -g create-react-app
13
14up to date, audited 1 package in 179ms
15
16found 0 vulnerabilities
17

the global yarn uninstall results with the following message:

1You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
2
3We no longer support global installation of Create React App.
4
5Please remove any global installs with one of the following commands:
6- npm uninstall -g create-react-app
7- yarn global remove create-react-app
8
9The latest instructions for creating a new app can be found here:
10https://create-react-app.dev/docs/getting-started/
11
12npm uninstall -g create-react-app
13
14up to date, audited 1 package in 179ms
15
16found 0 vulnerabilities
17remove create-react-app
18yarn global v1.22.17
19warning package.json: No license field
20[1/2] 🗑  Removing module create-react-app...
21error This module isn't specified in a package.json file.
22info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
23
24

Finally I try to find if create-react-app exists on my machine with which create-react-app which results in create-react-app not found.

I'm not sure how else to address this issue.

Edit: Solution provided by Deepthi and Sators. I had to clear the npx cache which had stored an older version of create-react-app by using command:

npx clear-npx-cache

ANSWER

Answered 2021-Dec-21 at 14:45

You can try to locate the installed version by running:

1You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
2
3We no longer support global installation of Create React App.
4
5Please remove any global installs with one of the following commands:
6- npm uninstall -g create-react-app
7- yarn global remove create-react-app
8
9The latest instructions for creating a new app can be found here:
10https://create-react-app.dev/docs/getting-started/
11
12npm uninstall -g create-react-app
13
14up to date, audited 1 package in 179ms
15
16found 0 vulnerabilities
17remove create-react-app
18yarn global v1.22.17
19warning package.json: No license field
20[1/2] 🗑  Removing module create-react-app...
21error This module isn't specified in a package.json file.
22info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
23
24npm ls -g create-react-app
25

You may also want to consider reading this post for removing/clearing the npx cache by using:

1You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
2
3We no longer support global installation of Create React App.
4
5Please remove any global installs with one of the following commands:
6- npm uninstall -g create-react-app
7- yarn global remove create-react-app
8
9The latest instructions for creating a new app can be found here:
10https://create-react-app.dev/docs/getting-started/
11
12npm uninstall -g create-react-app
13
14up to date, audited 1 package in 179ms
15
16found 0 vulnerabilities
17remove create-react-app
18yarn global v1.22.17
19warning package.json: No license field
20[1/2] 🗑  Removing module create-react-app...
21error This module isn't specified in a package.json file.
22info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
23
24npm ls -g create-react-app
25npx clear-npx-cache
26

Finally, another option is to ensure you are using the latest version of create-react-app by running:

1You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
2
3We no longer support global installation of Create React App.
4
5Please remove any global installs with one of the following commands:
6- npm uninstall -g create-react-app
7- yarn global remove create-react-app
8
9The latest instructions for creating a new app can be found here:
10https://create-react-app.dev/docs/getting-started/
11
12npm uninstall -g create-react-app
13
14up to date, audited 1 package in 179ms
15
16found 0 vulnerabilities
17remove create-react-app
18yarn global v1.22.17
19warning package.json: No license field
20[1/2] 🗑  Removing module create-react-app...
21error This module isn't specified in a package.json file.
22info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
23
24npm ls -g create-react-app
25npx clear-npx-cache
26npx create-react-app@latest --template typescript .
27

Source https://stackoverflow.com/questions/70352503

QUESTION

react native typescript 'string' is not assignable to parameter of type 'never.' in useNavigation

Asked 2022-Feb-15 at 17:51

[I keep getting the error that says 'string' is not assignable to parameter of type 'never' in react native typescript and I don't know why. Can someone help me fix this bug.

Thank you in advance.]1

code snippet :

1const loadReport = (id: string) => {
2    setPostId(id);
3    navigation.navigate('Report', {postId: id});
4}
5

I get an underline under 'Report'.

ANSWER

Answered 2021-Oct-11 at 12:01

The only solution I found is to apply the type never on the string name.

1const loadReport = (id: string) => {
2    setPostId(id);
3    navigation.navigate('Report', {postId: id});
4}
5const goToContent = () => {
6    navigate("Content" as never, {} as never);
7};
8

I'm not sure it's the best solution but it's work.

Source https://stackoverflow.com/questions/68667766

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in TypeScript

Tutorials and Learning Resources are not available at this moment for TypeScript

Share this Page

share link

Get latest updates on TypeScript