Tech

Chrome ‘Conformance’ for JavaScript frameworks says: If you don’t follow our rules, your project won’t build

Google’s Chrome team has introduced projects to assist framework authors with what it considers best practice, starting mainly with the React-based Next.js.

A team of six people (apparently known internally as WebSDK) who work on Chrome introduced what it called project Aurora earlier this week, described as a “collaboration with framework authors.” The post talks up the benefits of “strong defaults and opinionated tooling,” based on experience with Google applications such as Search and Maps.

Aurora, said Google, will identify weak spots in web frameworks, specifically those that cause “user experience pain,” and then fix them in a manner adaptable to other web frameworks as well. All the frameworks mentioned are JavaScript or TypeScript (which compiles to JavaScript), as you would expect from a browser team.

Work already carried out includes an image component for Next.js, then ported to Nuxt, inline CSS for web fonts for Next.js and Angular, and a custom plugin for ESLint (static analysis) support in Next.js.

A related project called Conformance is again focused on best-practice defaults but supplemented by “actionable rules.” Developers who fancy their skills at writing reliable and performant JavaScript should look away now since the Googlers reckon: “Optimizations that require any decision by developers pose a risk to the performance of the application.”

Therefore the team has devised a set of static code analysis rules and dynamic checks, spanning multiple “surfaces” including ESLint, TypeScript, dynamic checks on the user’s development server, the Webpack bundler, and CSS tooling. Developers who breach the rules will get warnings to fix the code, while “at build time, unresolved issues that are high severity will gate successful build completion.” Translation: breaching the Conformance best practices will prevent a project from building. That, we guess, is why the project is called Conformance, or should that be “Google knows best?”

These innovations are coming first to Next.js, which is why these projects were introduced to the world at the same time as the Next.js Conf this week. During the event, Next.js 11 was released, with Conformance touted as “a system that provides carefully crafted solutions to support optimal UX.”

This, along with improved performance and the adoption of Webpack 5 by default, was presented as the highlights of the new version. Vercel, sponsors of Next.js, also presented a project to convert React apps started with the Create React App command to be Next.js compatible, and a preview of a new browser-based, cloud-hosted coding environment called Next.js Live.

Google’s moves with Aurora and Conformance are in one sense a benefit to the web development community, in that they should improve performance and user experience by optimising the libraries that developers use, something normally out of reach of a team working on the browser platform.

There are caveats, though. Google’s apparent favouring of Next.js may increase the momentum behind this framework at the expense of alternatives, and although in its Aurora post the team said its work is “to deliver the best user experience possible for production apps regardless of the browser you’re rendering in,” it is hard to escape the notion that Google is building an optimised stack based on Chrome and Next.js.

An intriguing paragraph in the Conformance post states: “Conformance is being explored in Next.js first with the goal of expanding to other frameworks (Nuxt, Angular, etc.). ESLint and TypeScript are already used in many frameworks in many different ways, but the concept of a cohesive, browser-level runtime system is being actively explored.”

It sounds as if this “browser-level runtime system” expands the scope of the browser platform to include specific JavaScript/TypeScript libraries. This has some logic as a means of improving performance and simplifying development, but could come at the expense of diversity, and also raises questions about whether such moves should happen in cross-industry bodies like the W3C rather than being accomplished by the Chrome team alone. Perhaps they will. ®


Source link

Related Articles

Back to top button