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
by kamranahmedse typescript
179452
NOASSERTION
Roadmap to becoming a web developer in 2021
by microsoft typescript
130477
MIT
Visual Studio Code
by angular typescript
80840
MIT
The modern web developer’s platform
by microsoft typescript
79882
Apache-2.0
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
by ant-design typescript
79578
MIT
An enterprise-class UI design language and React UI library
by puppeteer typescript
77484
Apache-2.0
Headless Chrome Node.js API
by storybookjs typescript
70458
MIT
📓 The UI component explorer. Develop, document, & test React, Vue, Angular, Web Components, Ember, Svelte & more!
by reduxjs typescript
57862
NOASSERTION
Predictable state container for JavaScript apps
by sveltejs typescript
57249
MIT
Cybernetically enhanced web apps
Trending New libraries in TypeScript
by vitejs typescript
40832
MIT
Next generation frontend tooling. It's fast!
by excalidraw typescript
28761
MIT
Virtual whiteboard for sketching hand-drawn like diagrams
by slidevjs typescript
19954
MIT
Presentation Slides for Developers (Beta)
by withfig typescript
16522
MIT
Fig adds autocomplete to your terminal.
by backstage typescript
16116
Apache-2.0
Backstage is an open platform for building developer portals
by type-challenges typescript
16090
MIT
Collection of TypeScript type challenges with online judge
by remix-run typescript
15742
MIT
Build Better Websites. Create modern, resilient user experiences with web fundamentals.
by appsmithorg typescript
15181
Apache-2.0
Low code project to build admin panels, internal tools, and dashboards. Integrates with 15+ databases and any API.
by cyrildiagne typescript
14263
MIT
Cut and paste your surroundings using AR
Top Authors in TypeScript
1
680 Libraries
444064
2
360 Libraries
0
3
338 Libraries
0
4
321 Libraries
0
5
287 Libraries
0
6
274 Libraries
3
7
257 Libraries
0
8
223 Libraries
0
9
213 Libraries
4856
10
207 Libraries
485
1
680 Libraries
444064
2
360 Libraries
0
3
338 Libraries
0
4
321 Libraries
0
5
287 Libraries
0
6
274 Libraries
3
7
257 Libraries
0
8
223 Libraries
0
9
213 Libraries
4856
10
207 Libraries
485
Trending Kits in TypeScript
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.
- Install the Node.js and React on your IDE(preferable Visual Studio Code).
- Create React Application using npx create-react-app foldername.
- cd foldername.
- Install npm i styled-components.
- Open the folder in IDE.
- 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.
- Open the terminal from IDE.
- 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.
- The solution is created in Visual Studio Code 1.73.1.
- The solution is tested on node v18.12.1 and npm v8.19.2.
- React version-18.2.0.
- 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
- For any support on kandi solution kits, please use the chat
- For further learning resources, visit the Open Weaver Community learning page.
Data Analysis
NLP
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.
Knowledge Resources
Kit Solution Source
Support
If you need help using this kit, you may reach us at the OpenWeaver Community.
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.
- Install the Node.js and React on your IDE(preferable Visual Studio Code).
- Create React Application using npx create-react-app foldername.
- cd foldername.
- Open the folder in IDE.
- 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.
- Add export default statement at end of the code(like 'export default App;').
- Open the terminal from IDE.
- 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.
- The solution is created in Visual Studio Code 1.73.1.
- The solution is tested on node v18.12.1 and npm v8.19.2.
- React version-18.2.0.
- 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
- For any support on kandi solution kits, please use the chat
- 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 these 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.
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
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.
Here are the top Node JS Web Scraping libraries that you can use for structured and unstructured data scrapping for data collection, price comparison, lead generation, news monitoring, job posting scraping, and social media monitoring.
Web scraping is the process of extracting data from websites. It involves making HTTP requests to a website's server, downloading the HTML content of the web page, and then parsing that data to extract the information you want.
The top Node JS web scraping libraries are shown below. Here is a detailed review of libraries.
crawlee:
- Offers real-time data extraction.
- Provides a user-friendly interface for configuring scraping tasks.
- Supports multiple scraping methods such as crawling, browsing, and request-response.
autoscraper:
- Offers a simple API for web scraping.
- Supports scraping dynamic web pages.
- Offers a built-in cache for storing scraped data.
siphon:
- Offers a simple API for web scraping.
- Supports scraping dynamic web pages.
- Has a built-in cache for storing scraped data.
scrapify:
- Offers a simple API for web scraping.
- Supports scraping multiple pages in parallel.
- Offers a built-in cache for storing scraped data.
graze:
- Offers a simple API for web scraping.
- Supports scraping and parsing HTML data.
- Offers a built-in queue for organizing scraping tasks.
browser-pool:
- Offers a pool of headless browser instances for efficient scraping.
- Supports scraping JavaScript-based websites.
- Offers automatic handling of common scraping tasks such as session management and proxy rotation.
webparsy:
- Offers a simple API for web scraping.
- Supports parsing structured data such as CSV, JSON, and XML.
- Offers automatic handling of common scraping tasks such as handling redirects and errors.
Tanto:
- Offers an API for web scraping with Node.js.
- Supports scraping dynamic web pages using headless Chrome.
- Has built-in support for handling common scraping tasks such as pagination and handling redirects.
Puppeteer-web-crawlers-js:
- Offers a high-level API for web scraping using Puppeteer.
- Supports scraping JavaScript-based websites.
- Offers automatic handling of common scraping tasks such as form submissions and click events.
Node-bvmf:
- Offers a simple API for scraping data.
- Supports retrieving real-time and historical data.
- Offers a built-in cache for storing scraped data.
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 2023 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.
The React routing library is a de-facto solution. It helps in managing navigation and routing in React applications. It provides various components and APIs. It handles different routing scenarios and creates complex routing systems within React apps. This library allows developers to build applications with smooth navigation and URL handling.
The React routing library allows you to create routes to handle paths and components. It supports path components, where a specific component is rendered for a given URL path. It allows for nested routes, where we define the child routes within a parent route. It creates complex routing hierarchies.
The React routing library can meet various requirements in different ways. It is suitable for simple pagination. It allows users to navigate through different pages of content. It supports routing, where we can load components and data based on the current URL or parameters. It enables the creation of dynamic and data-driven web applications.
When using this library to create applications, we recommend leveraging its features. It uses the appropriate hooks and components to manage routing-related logic. This includes creating custom routes matching URL patterns. It includes handling complex application states using URL parameters and query strings.
This library offers features to enhance the user experience in your web applications. You can simplify complex routes by using route nesting and grouping. It makes navigation more intuitive for users. You can redirect users to the correct pages when it meets certain conditions.
The React routing library helps create complex web applications with efficient routing. It improves the user experience. Developers can build rich user interfaces by leveraging nested routing and custom routes.
In conclusion, the React routing library for managing navigation and routing. Its extensive components and APIs, along with its active community and ecosystem. It is a go-to choice for front-end developers. By mastering this library, developers can create web applications with improved code quality. It can create dynamic routing and enhanced user experiences.
react-router:
- Helps in creating a single-page application (SPA) with many routes.
- Supports nested routes, allowing for complex route structures.
- Enables easy navigation between different views within a React application.
- Provides flexible routing configuration options and supports both hash-based and history-based routing.
react-navigation:
- Used for building navigation structures in React Native applications.
- Offers different navigators, like stack navigator, tab navigator, and drawer navigator.
- Supports deep linking and navigation state management.
- Provides customizable navigation options and transitions.
wouter:
- A lightweight routing library that focuses on performance and small bundle size.
- Provides a simple and intuitive API for defining routes.
- Supports client-side routing and server-side rendering.
- Offers a hook-based approach for managing routes.
navi:
- Offers a declarative and composable API for routing in React applications.
- Provides a powerful navigation object that encapsulates route information.
- Supports async route resolution and data fetching.
- Enables route-based code splitting and lazy loading.
react-native-router:
- Allows for routing within React Native applications.
- Provides a similar API to React Router DOM. It makes it easy to transition between web and mobile platforms.
- Supports features like nested routes, route parameters, and URL query parameters.
- Integrates well with React Native navigation libraries like React Navigation.
react-native-location:
- A lightweight routing library that focuses on simplicity and ease of use.
- Provides a simple API for defining routes and handling navigation.
- Supports basic route matching and rendering of components based on the current URL.
- Offers built-in support for query parameters and URL decoding.
rill:
- A minimalist routing library for React applications.
- Emphasizes simplicity and minimalism in its API design.
- Supports declarative routing and nested routes.
- Offers features like route guards, middleware support, and route-based code splitting.
raviger:
- A small and fast routing library for React applications.
- Supports nested routes and route parameters.
- Provides a simple API for defining routes and handling navigation.
- Offers advanced features like route transition animations and route lifecycle hooks.
FAQ
1. What is the React routing library, and what does it do?
The React routing library is a routing solution for React applications. It provides various components and APIs. It enables developers to handle navigation and routing within their applications. With React routing, developers can create and map different routes to components. It can manage the rendering of components based on the current URL.
2. Where can I find a React Router Tutorial to help me get started?
If you're looking for a tutorial to help you, you can find resources on their official website. The website offers detailed guides, tutorials, and examples. It covers aspects of using React Router for navigation and routing in applications. These resources are a starting point for understanding the library's concepts.
3. How are React web applications using the React routing library?
React web applications benefit from the React routing library in several ways. Developers can use this library to create applications with smooth and seamless navigation. It enables rendering different components based on specific routes. It allows a dynamic and interactive user experience. React routing helps manage browser history and handle URL parameters. It will implement features like nested routing and route guarding.
4. What are some good 7 React Projects that use the routing library?
Many React projects make use of the routing library. These projects showcase the flexibility of this library in building robust web applications. Some good examples of such projects include e-commerce applications with complex navigation structures. It includes social media platforms with dynamic content rendering based on user profiles. Then it includes content management systems with multi-level menus and content categorization. It includes blogging platforms with nested routing for blog posts and categories.
5. What skills must a Senior React Developer have to work with the routing library?
A Senior React Developer working with the routing library should have several skills. These include an understanding of JavaScript, knowledge of React hooks, and context API. It has expertise in handling state management within applications. It offers a deep understanding of React Router and its various components. Senior developers should have experience building complex web applications. It can architect scalable and maintainable routing structures.
6. How has adding the React routing library changed the React ecosystem?
The addition of the React routing library has impacted the React ecosystem. It has provided developers with a robust and standardized solution. It helps in managing navigation and routing in React applications. With React routing libraries' availability, developers can build complex single-page applications. It enables smooth transitions between different views and efficient handling of URLs. The React routing library has become integral to the React ecosystem. It empowers developers to create rich and interactive user experiences.
To sort a list of items in a combo box using React, we must create an array of strings which will be our list, and then we will map it out as an unordered list. Then we can also create the dropdown to select which type of sorting needs to be applied.
A Combobox is nothing but plain text input from the user that can provide a list of suggestions based on the input given by the user.
Types of Combobox in React,
- Simple combo box - that consists of an editable box with an attached list box containing a list of items.
- Dropdown list box - that consists of the static text box that represents the currently selected item by the user, and a list of items will show on the dropdown list.
- Dropdown combo box - it combines a dropdown list with an editable box. Thus we can either type an item's text or select an item from the dropdown list.
Here we are using a library called 'react-select' that allows us to select single or multiple values, search for available options asynchronously, and apply unique styles to a component in React. The sort() method in React allows us to sort the array elements in place and are returning the reference to the same array, currently sorted. In the sort() method, the default order of execution is ascending, built upon converting the elements into strings and then comparing their sequences of UTF-16 code unit values. There are two distinct types of sorting, one is the sort() method, and another one is sorted(). By comparing both, sorting is slightly faster than sorting and consumes around 24% less memory to store data. Sort is implemented only for lists, whereas sorted will accept any iterable. One of the most efficient ways to sort elements in a computer system is 'Quicksort'.
Here is an example of how you can sort Combobox items in React:
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 React-select library.
Instructions
Follow the steps carefully to get the output easily.
- Install the Node.js and React on your IDE(preferable Visual Studio Code).
- Create React Application using npx create-react-app foldername.
- cd foldername.
- Open the folder in IDE.
- Copy the code using "copy" button above and paste it in app.js file(remove the earlier code from app.js) and also refer demo given below for your reference.
- Add export default statement at end of the code(like 'export default App;').
- Open the terminal from IDE.
- 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 'how to sort combo box items 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.
- The solution is created in Visual Studio Code 1.73.1.
- The solution is tested on node v18.12.1 and npm v8.19.2.
- React version-18.2.0.
- React-select version-5.3.0.
Using this solution, we are able to implement sorting combo box items on 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 implement sorting combo box items on react.
Dependent Library
You can also search for any dependent libraries on kandi like 'react' and 'react-select'.
Support
- For any support on kandi solution kits, please use the chat
- For further learning resources, visit the Open Weaver Community learning page.
Here are the best open-source Vue menu component libraries for your applications. You can use these to build user interfaces and menus that are important UI components.
Menus provide navigation and access to different sections of an application. Several Vue menu component libraries are available, making it easy for developers to implement menus in their projects. These provide a range of customizable menus, including dropdown menus, context menus, and navigation drawers. Certain libraries also provide a variety of pre-built menu components that can be easily integrated into Vue projects. Some Vue menu component libraries provide simple, easy-to-use components with a sliding sidebar menu and customizable animations. These libraries provide a range of customizable menu options, allowing developers to create menus that fit the specific needs of their projects.
With several pre-built options and highly customizable components, developers can quickly and easily create menus that provide users with an intuitive and user-friendly experience. We have handpicked the top and trending open-source Vue menu component libraries for your next application development project:
Vuetify:
- Used in User Interface, Vue applications, etc.
- Features include dropdown menus, context menus, and navigation drawers.
- Offers a range of customizable menus with various pre-built menu components.
Vue-Context-Menu:
- Used in User Interface, Menu, Vue applications, etc.
- Provides a customizable context menu.
- Display a range of options when a user right-clicks on an element.
Vue-Multilevel-Menu:
- Used in User Interface, Menu, Vue, Nodejs, jQuery applications, etc.
- Provides a multilevel menu with customizable animations and styles.
- Offers vue. js-based solution for creating a multilevel drop-down menu.
VueCircleMenu:
- Used in User Interface, Vue applications, etc.
- Provides a beautiful circle menu powered by Vue.js.
- Offers six types of menus: top, bottom, left, right, middle, and middle-around.
Vue-stripe-menu:
- Used in User Interface, Menu applications, etc.
- Allows creating a navigation menu with animations like on Stripe.
- Helps create a minimal and clean dropdown navigation menu.
V-Menu:
Used to create menus premised on mouse operation such as window, context-menu, nested-menu, etc.
It’s a highly customizable menu component library.
Provides a range of menu styles, including dropdown menus, context menus, and off-canvas menus.
Here are the best Angular grid libraries for your web application. These libraries provide various functionalities that can be easily integrated with Angular-based development. You can use this collection of tools to create and manage grid-based layouts in multiple applications.
A grid layout is a series of rows and columns to arrange and align elements on a web page. Angular grid libraries provide a range of features, including:
- Responsive design: Many Angular grid libraries allow developers to create responsive designs that automatically adjust to different screen sizes.
- Column and row management: Angular grid libraries typically provide ways to define the number of columns and rows in a grid and to specify the width and height of individual cells.
- Data binding: Angular grid libraries often support data binding so that data from a model can be automatically displayed in the grid.
- Sorting and filtering: Angular grid libraries often include features for sorting and filtering data in the grid, making it easier to manage large datasets.
- Customization: Many Angular grid libraries allow developers to customize the appearance and behavior of the grid, such as setting colors, fonts, and styles.
We have handpicked top and trending Angular grid libraries based on popularity, licensing, and unique features to build beautiful and functional grid-based layouts in your applications:
Ag-grid:
- Used in User Interface, Grid, Angular, and React applications.
- A feature-rich data grid with both free and enterprise versions.
- Provides a wide range of features, including sorting, filtering, pagination, and grouping.
PrimeNG:
- Used in User Interface, Chart, Angular, Bootstrap, and jQuery applications.
- Provides a comprehensive set of UI components, including a data grid.
- Offers advanced features such as lazy loading, virtual scrolling, and row grouping.
ngx-datatable:
- Used for highly customizable and performance-optimized data table functionality.
- Is an Angular component for presenting large and complex data.
- Supports features like pagination, sorting, and filtering,
- Offers advanced features like virtual scrolling and column resizing.
Material Table:
- Used for its simple and powerful Datatable functionality.
- Is a data grid library for Angular.
- Built on top of the Material Design components.
- Provides a wide range of features, including pagination, sorting, filtering, and row selection.
ng2-smart-table:
- Used for its highly customizable data grid capabilities.
- Provides a range of features, including pagination, sorting, and filtering.
- Supports editing, adding, and deleting rows.
Angular Material Data Table:
- Used for visualizing and manipulating large data sets.
- Is a data grid component built on the Angular Material library.
- Provides a range of features, including sorting, filtering, and pagination.
- Advanced features like virtual scrolling and column resizing.
Angular-tree-grid:
- Used in User Interface, Grid, Angular applications, etc.
- Provides hierarchical data representation.
- Supports features like sorting, filtering, and pagination,
- Advanced features like lazy loading and tree expansion.
Here are the best open-source Python sound-processing libraries for your applications. You can use these pre-built components and utilities to create chat interfaces for web or mobile applications.
You can choose from various libraries that offer different levels of complexity and features and easily integrate them with the existing tech stack. These libraries simplify the development process by providing standard functionality with customization capabilities, such as real-time messaging, user authentication, and UI components. React chat libraries can also ensure consistency across different platforms, as many libraries are built to work across web and mobile applications. Additionally, many libraries offer out-of-the-box support for commonly used chat features such as push notifications, file sharing, and group chats.
Choosing the right library based on the application’s specific needs is essential. You should carefully consider features, compatibility, and support when selecting a library to ensure it meets your requirements. We have handpicked top and trending open-source React chat libraries for your next project.
React Native Gifted Chat:
- Used a customizable and user-friendly chat interface for React Native.
- Supports image and video attachments.
- Offers user avatars, quick replies, and more features.
React-Chat-UI:
- Used in Messaging, Chat, React applications, etc.
- Designed to be lightweight and easily customizable.
- Provides a simple chat interface.
- Supports avatar icons, typing indicators, and message status indicators.
React Chat Kit:
- Used to Build chat UI with React components in a few minutes.
- Provides a set of tools for building chat applications in React.
- Supports real-time messaging, group chats, read receipts, and more.
React Simple Chat:
- Used to create conversation chats using simple chatbot components.
- Provides a simple and minimalistic chat interface for React.
- Supports real-time messaging and is easily customizable.
React-Chat-Elements:
- Used for building chat interfaces in React.
- Provides a set of UI elements like popup, navbar, sidebar, dropdown, etc.
- Supports real-time messaging, user avatars, and message statuses.
React-Chat-Widget:
- Used for integrating chat functionality into a React application.
- Provides a simple chat widget that supports real-time messaging.
- Offers customization options for styling and branding.
React-Chat-App:
- Used to build a fully functional chat application built with React.
- Supports real-time messaging, user authentication, etc.
- Offers customization options for styling and branding.
ChatUI:
- Used in User Interface, React applications, etc., for Conversational UI.
- Offers responsive design to adapt automatically to different devices.
- Supports Chrome, Firefox, Safari, Android WebView, Microsoft Edge, and more.
In JavaScript applications, we allow developers to parse and manipulate documents. It is a JavaScript HTML parser library. These are useful for applications for web scraping and data extraction. It will help build HTML editors. Developers can save time and effort by not needing to write their own HTML parsing. Also, to manipulate code from scratch.
Here are the best libraries organized by use cases. The best libraries are xmldom, DOM parsing, DOM parser, jsdom, parse5, cheerio, htmlparser2. A detailed review of each library follows.
Let's look at each library in detail. The links below allow you to access package commands, installation notes, and codesnippets.
cheerio:
- A fast and lightweight library. It allows developers to parse, manipulate, and traverse HTML and XML documents.
- Designed to be lightweight, with a small memory footprint and minimal dependencies.
- Supports loading HTML documents from various sources, including URLs, local files, and strings.
- Built on top of Node.js, and can build web scrapers, crawlers, and other Node.js applications.
jsdom:
- JavaScript implementation of the W3C DOM. It allows developers to create a virtual DOM environment in Node.js.
- Support the entire DOM specification, including elements, attributes, text nodes, and events.
- Support synchronous and asynchronous loading of external resources, like images, stylesheets, and scripts.
- Ability to execute JavaScript in the virtual DOM environment. The environments can be event handlers and scripts embedded in HTML.
htmlparser2:
- Provides various options for parsing HTML documents. It includes support for custom element and attribute handlers. It also can parse streaming data.
- Designed to be efficient and can process large HTML documents.
- Designed to be lightweight and memory-efficient, with a small memory footprint.
- Handling malformed or incomplete HTML documents and providing error reporting and recovery capabilities.
parse5:
- Designed to be efficient, with a small memory footprint and minimal dependencies.
- Various options for parsing HTML documents. The options can be the ability to parse streaming data and parse fragments of HTML.
- Handling malformed or incomplete HTML documents and providing error reporting and recovery capabilities.
- Various methods for manipulating HTML documents. The methods can add, remove, and modify elements, attributes, and content.
xmldom:
- Provides a DOM-like API for parsing XML documents. It can take an XML string as input and convert it into a DOM tree structure that we can traverse and manipulate.
- Follows the DOM standard. It provides a similar interface for working with XML documents. It represents XML elements, attributes, and text nodes as DOM nodes. It represents it with properties and methods.
- Allows you to change the XML document by adding, removing, or updating nodes. It helps to manipulate attribute values and text content.
- Provides serialization functionality to convert the modified DOM tree into an XML string.
domparsing:
- Converting an XML or HTML document into a DOM tree structure. We can traverse and manipulate.
- Represents the XML document as a tree structure with nodes. We can represent it with elements, attributes, and text content.
- One of the key benefits of DOM parsing is the ability to modify the XML document. You can add, remove, or modify nodes. You can change attribute values, insert new elements, or update text content.
- Once you have manipulated it, you can serialize it back into a string representation. The representations can be for storage, transmission, or further processing.
domparser:
- Built-in API that allows developers to parse an HTML or XML document and create a DOM tree in JavaScript.
- The object is part of the W3C DOM standard, and we can support it with all modern browsers and Node.js.
- The object provides a convenient way to parse XML or HTML strings into DOM objects. We can manipulate using standard DOM APIs.
FAQ:
1. What are the DOM manipulation capabilities of a JavaScript html parser library?
A JavaScript HTML parser library provides DOM manipulation capabilities. It will allow interaction and modification of the parsed HTML document. Here are some common DOM manipulation capabilities provided by such libraries:
- Accessing Elements
- Modifying Element Attributes
- Manipulating Element Content
- Creating and Removing Elements
- Traversing the DOM Tree
2. How does Xpath work with web automation tools and JavaScript html parser libraries?
XPath is a powerful query language. It navigates and selects nodes from XML or HTML documents. It provides syntax to specify the element location or attributes within a document. With web automation tools, we can use XPath to locate and communicate with elements on a web page.
Here's how XPath works with these tools:
- Locating Elements
- Selecting Nodes
- Iterating Over Results
- Complex Selection
- Cross-Browser Support
3. What is the difference between a DOM document and String html? What is the difference when using a JavaScript html parser library?
The difference is it represents the parsed version with methods and properties. It will help interact with its elements, attributes, and content. But string HTML is the initial textual representation. We should parse it into a DOM document using an HTML parser library to access and manipulate its contents.
4. How can I create a DOM Document Creator with a javascript html parser library?
To create a DOM Document using a JavaScript HTML parser library, you follow these steps:
- Import the HTML Parser Library
- Create a Document Object
- Manipulating the Document
- Serialization
5. Can a JavaScript html parser library process actual Html documents?
Yes, it is possible to use a JavaScript HTML parser library to process actual HTML documents. HTML parser libraries parse and manipulate HTML documents within JavaScript applications.
A React CSV builder library is a powerful tool for handling CSV files in React applications. It provides a range of functionalities that simplify the process of generating, reading, writing, and manipulating CSV data. With this library, developers can seamlessly convert data from various types, such as text, numbers, and dates, into the CSV format and vice versa. It ensures proper handling and formatting to adhere to the CSV standard. These libraries often come with components for data input, allowing users to upload CSV files, as well as components for data output, enabling the download of CSV files. Additionally, they offer utilities for processing tasks like parsing, filtering, and sorting CSV data. By integrating a React CSV builder library, developers can efficiently work with tabular data and leverage the benefits of CSV functionality within their React applications.
A few best practices for making the most of a React CSV builder library are essential to keep in mind. Right off the bat, these libraries frequently take into account the production of custom parts, giving adaptability to fit the CSV dealing with experience to explicit task necessities. Furthermore, execution advancement is urgent while managing enormous CSV documents or handling broad datasets. To improve the efficiency of CSV operations, it is suggested that features like chunk processing or multi-threading be utilized. Ultimately, while working with CSV information, guaranteeing appropriate treatment of segment headers and keeping up with information respectability is significant for exact information portrayal and handling. Developers can effectively utilize a React CSV builder library in their projects and take advantage of its capabilities to handle CSV data by following these guidelines.
In conclusion, a useful tool for working with CSV files in React applications is a React CSV builder library. By providing functions for generating, reading, writing, and manipulating CSV data, it makes handling CSV simpler. In addition to utilities for data processing tasks, these libraries provide components for data input and output. Utilizing the capabilities of a React CSV builder library, developers can efficiently work with tabular data in their React applications by creating custom components, optimizing performance, and ensuring proper data handling.
react-csv:
- Used for handling CSV files in React applications.
- Offers a simple API for generating and parsing CSV data.
- Supports customization options for delimiter and column headers.
- Efficiently exports data from React applications into CSV files.
react-papaparse:
- Used for parsing CSV files in React applications.
- Offers powerful CSV parsing using the Papaparse library.
- Supports features like automatic type inference and error handling.
- Provides a flexible solution for parsing and processing CSV data in React applications.
react-data-export:
- Used for generating and exporting CSV files in React applications.
- Offers an easy API for defining CSV data and customizing filename, delimiter, and encoding.
- Simplifies the process of generating and downloading CSV files.
- Convenient tool for exporting data in CSV format, such as generating reports or sharing data.
react-csv-reader:
- Used for reading and parsing CSV files in React applications.
- Offers a file input component for uploading CSV files from local machines.
- Converts CSV data into an array or JSON format for easy processing.
- Simplifies the handling and parsing of CSV data in React components.
react-csv-downloader:
- Used for generating and downloading CSV files in React applications.
- Offers a simple API for defining CSV data and customizing filename, delimiter, and encoding.
- Provides a straightforward solution for generating and downloading CSV files.
- Useful for exporting data in CSV format, such as generating reports or sharing data.
FAQ:-
1. What is the JavaScript CSV builder library and how can I use it in a new React project?
For managing CSV files in JavaScript-based projects, including React applications, the JavaScript CSV builder library is a powerful tool. To utilize it in a new Respond project, you can begin by introducing the library as a npm bundle and bringing it into your undertaking. Then, within your React components, you can generate, read, write, and manipulate CSV data by utilizing the library's components and utilities. You can seamlessly incorporate CSV handling capabilities into your React project by utilizing the library's features.
2. How do I read a CSV file using the react csv builder library?
Reading CSV files is supported by the react csv builder library. Users can upload CSV files from their own computers by making use of the library's data input component. The library then takes care of the file parsing process, transforming the CSV data into a format that your React components can easily work with. The data from the CSV file can now be accessed and manipulated within your application, making it easier to perform data analysis, rendering, or further processing.
3. What kind of file parsing does the library provide when dealing with CSV files?
The react csv builder library has extensive file parsing capabilities for working with CSV files. It handles various aspects of file parsing, such as extracting column headers, parsing individual rows and columns, and determining the appropriate CSV file delimiter. This guarantees that the CSV data will be correctly structured and parsed for subsequent use. You can handle edge cases or specific parsing requirements by customizing the file parsing process through the library's options.
5. How can I display table data from my CSV files using this library?
Using the react csv builder library, it's easy to display table data from CSV files. When the CSV information is parsed and accessible inside your Respond parts, you can use the library's parts or custom parts to deliver the information in an even configuration. You can make an interactive and appealing CSV data representation by mapping the data to HTML table elements or using React table libraries. This permits clients to effortlessly peruse, search, and sort the table information inside your Respond application.
4. Does the react csv builder support converting data into JSON format for manipulation?
Yes, you can manipulate data by converting it into the JSON format using the react csv builder library. You can easily convert the CSV data into JSON format after using the library's functions to read and parse it. This empowers you to work with the information in a more organized and adaptable way, utilizing the upsides of JSON for information control, separating, or showing purposes. The utilities and components of the library make the process of conversion easier, making it easy to switch between CSV and JSON formats whenever necessary.
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:47I 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:34It 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.
QUESTION
AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire
Asked 2022-Apr-01 at 12:56I 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:20AngularFire 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
QUESTION
ESLint: 8.0.0 Failed to load plugin '@typescript-eslint'
Asked 2022-Mar-31 at 09:08Could 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:33https://github.com/typescript-eslint/typescript-eslint/issues/3982
It seems to be a compatibility problem
QUESTION
Why does typescript allow me to import dependencies it can't use at runtime?
Asked 2022-Mar-28 at 07:32You 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 work1import 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
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:34Your 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 fullexports
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 thedefault
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.
QUESTION
The unauthenticated git protocol on port 9418 is no longer supported
Asked 2022-Mar-27 at 13:23I 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:01First, 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 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).
QUESTION
in Typescript, try...catch error object shows "Object is of type 'unknown'.ts(2571)"
Asked 2022-Mar-18 at 03:471router.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)
Thanks for sharing Youtube video,
ANSWER
Answered 2021-Oct-03 at 06:44In 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
QUESTION
Uncaught ReferenceError: Buffer is not defined
Asked 2022-Mar-17 at 15:41Our 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:
- Setting fallback + install with npm
1fallback: {
2 "stream": require.resolve("stream-browserify"),
3 "buffer": require.resolve("buffer/")
4}
5
- 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:15Answering my own question. Two things helped to resolve the issue:
- 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
- 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
QUESTION
ESlint - Error: Must use import to load ES Module
Asked 2022-Mar-17 at 12:13I 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:08I 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.
QUESTION
npx create-react-app prompting to globally uninstall non-existent create-react-app package?
Asked 2022-Feb-19 at 03:11I 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:45You 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
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:01The 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.
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