{"content":"Have you ever been unable to properly build a PCF control because of linting errors? Well, lately I have, and it can get really frustrating. Especially when the errors have nothing to do with your code, but are caused by an unexpected failure in the way the PCF framework handles the linting process.\nTurns out I\u0026rsquo;m not alone as other members of the PCF community like Charles Channon have recently flagged linting issues with recent pcf-scripts releases.\nIn this post, I’ll show you how I found a way to skip linting during the PCF control build process. This keeps you focused on building and deploying your controls, even if the linter crashes.\nBut while we are at it, let’s talk about what linting is and how it’s implemented in PCF projects.\nLinting in PCF controls In a nutshell, linting is a static code analysis process that checks your code for errors, potential bugs, and style violations. By enforcing coding standards, it helps catch problems early in the development cycle, and improve overall code quality.\nMany projects run linting automatically during builds, commits, and even within the IDE during development to catch issues early.\nThe PCF framework integrates ESLint, a popular linting tool, into the scaffolded code generated by the pac pcf init command. When a PCF project is initialized, a file named eslint.config.mjs is added to the project structure.\nThe eslint.config.mjs file contains a set of recommended rules, along with a rules section that you can customize to your liking. There’s a lot more more to dive into, but that’s beyond the scope of this post.\nWith proper setup in your IDE this will make you editor scream when rules are infringed.\nIn typical TypeScript projects, linting is generally under your control and can be executed on demand. But in PCF control development, linting is baked into the build process. The pcf-scripts package runs ESLint every single time you call npm run build.\nWhile this setup works well in an ideal world, I’ve occasionally run into unexpected crashes during the linting step.\nIn my experience, these issues rarely relate to actual linting rules. They usually stem from deeper configuration quirks or conflicts with other dependencies. It’s really annoying and makes it impossible to move on.\nSo, let’s look at how we can separate the linting step from the PCF build,\nSkipping Linting during PCF Build With a bit of reverse engineering, I tracked down the part of the pcf-scripts package where the linting task is invoked during the build.\nLocated deep in node_modules\\pcf-scripts\\tasks\\validateTask.js, I discovered that linting could be skipped if context.getSkipBuildLinting() returned true. Looks promising, but how is this property set ?\nI figured out that the build context was defined in this file node_modules\\pcf-scripts\\buildContext.js, and found that getSkipBuildLinting() gets is value from a configuration switch. Getting closer\u0026hellip;\nDigging further, I found that the context object is configured in node_modules\\pcf-scripts\\buildConfig.js. I’m nearly there, I can tell\u0026hellip;\nFrom there, I traced the configuration source to node_modules\\pcf-scripts\\constants.js, where the constant CONFIGURATION_FILE_NAME revealed that the settings are loaded from the project’s own pcfconfig.json. BINGO!.\n💡That’s when it clicked— and I knew I had blog post material on my hands.\nNow, by simply adding a line of code to the pcfconfig.json and setting skipBuildLinting to true\u0026hellip;\n\u0026hellip;we can see that the Linting step gets properly skipped when we build the control. 😎\nBy doing this, I was able to decouple linting from the build, and go back to the real development of the control.\nAlso, like Charles Channon pointed out in the LinkedIn post mentioned earlier, you can still run EsLint manually at any time using a command that doesn\u0026rsquo;t rely on the PCF framework. The best of both worlds!\nnpx eslint \u0026#39;./**/*.{ts,tsx}\u0026#39; --format stylish TakeAway Linting is a powerful tool that helps keep your code clean, consistent, and error-free. It’s important for any serious project. But sometimes, you just need to get things done and can’t afford to be blocked by unexpected linting crashes.\nIn PCF projects, linting is enforced as part of the build by default. But, you can skip the linting step by adding \u0026quot;skipBuildLinting\u0026quot;: true to your pcfconfig.json file—something that’s not officially documented, but works.\nYou can still run linting manually at any time using a standalone command that bypasses the PCF Framework scripts.\nHope this helps!\nI haven\u0026#39;t needed to build a #PCF in a few months, but just initted one and hit a strange error related to the eslint formatter. | Charles Channon I haven\u0026#39;t needed to build a #PCF in a few months, but just initted one and hit a strange error related to the eslint formatter. For some reason, it kept spitting out an empty error (no warnings or errors, just a flat failure) - this appears to be an issue in the pcf-scripts invocation of eslint and the default formatter. The fix is easy: don\u0026#39;t rely on pcf-scripts to lint for you: just invoke eslint yourself with: ``` npx eslint \u0026#39;./**/*.{ts,tsx}\u0026#39; --format stylish ``` www.linkedin.com Find and fix problems in your JavaScript code - ESLint - Pluggable JavaScript Linter A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease. eslint.org ","date":"2025-07-08T01:09:42Z","image":"/pcf-controls-tips-and-tricks-how-to-skip-linting-at-build-time/lint_feathers_finger_white.jpg","permalink":"/pcf-controls-tips-and-tricks-how-to-skip-linting-at-build-time/","title":"PCF Controls Tips and Tricks : How to skip Linting at Build-Time"}