![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@closeio/best-practices-documentation
Advanced tools
Tooling to document best practices in your code base.
close-best-practices
is a library and a tool to help teams document their
coding best practices.
(Interested in working on projects like this? Close is looking for great engineers to join our team!)
This library is built to embody the following principles:
You can install this package via npm:
npm i --save-dev @closeio/best-practices-documentation
yarn add -D @closeio/best-practices-documentation
You can tag blocks of code as best practices with specially formatted comments:
// @BestPractice React Components
// @BestPractice.subtitle State Updates
// @BestPractice.description
// If you need to update state based on the current value, use
// the functional version of the state setter rather than using
// the `value`. This keeps `useCallback` from creating a new function
// every time the value changes.
const [value, setValue] = useState(0);
const incrementValue = useCallback(
() => setValue((currentValue) => currentValue + 1),
[],
);
// @BestPractice.end
You can also document values in JSX blocks with the {/* ... */}
comment
format.
Check out the sample project that is part of the code to see more examples.
.js
, .jsx
, .ts
, and .tsx
extensionsTo extract your best practices documentation, you can invoke our CLI tool:
npx best-practices write -s src/ -g docs/best-practices -u "https://github.com/<your org>/<your repo>/tree/main"
This will scan through your code in src
and build best practices Markdown
files from your tagged code. The contents of the -g
directory will be
completely overwritten, so make sure you point to a directory that doesn't
contain any manually written documentation.
This will also write out a digest.txt
file that is used to track changes to
your generated documentation.
You can check to see if your generated docs are out of date with your code with
the check
subcommand:
npx best-practices check -s src/ -g docs/best-practices
This will gather your best practices documentation from your code and generate a
digest, and compare those to the digest that was written out the last time docs
were generated. The check
command will exit with a status code of 1
if the
docs are out of date, making this a good command to use in a pre-commit hook or
a CI step.
If you'd like to insert (and keep up-to-date) some best practices into static documentation, meaning docs that you type out yourself, and aren't completely controlled by this tool, you can do that with specially formatted comments and meta tags.
In your code, add a id
meta field to the documentation block:
// @BestPractice.id insertIntoStaticDocs
This id should be unique throughout your codebase, but this is not checked or enforced by the tool. If you have multiple best practice blocks with the same ID then the last one picked up by the tool when parsing your code will be used.
In your static markdown documentation file, add a comment like this where you'd like to insert a best practice:
<!-- @BestPractice.insert insertIntoStaticDocs -->
<!-- @BestPractice.end -->
If your file is a .mdx
Markdown file, use JSX
style comments instead:
{/* @BestPractice.insert insertIntoStaticDocs */}
{/* @BestPractice.end */}
It's important to have both the start and end lines, as these will be used as boundaries of the program to know where to replace the code.
In order to write out to static docs, you'll have to point the tool at your docs
root with the -d
command line argument.
E.g.
`npx best-practices write -s src/ -g docs/best-practices -d docs/ ...`
If a best practice is inserted into static documentation, it will not be inserted into the generated docs. It will however still be included in the digest for checking doc freshness.
There are several strategies for keeping your docs up-to-date:
best-practices write
best-practices check
best-practices check
best-practices
command as part of that.If the default usage of the CLI tools doesn't fit your needs, you can use the
library to customize your best practice generation. We export all the primary
utility functions that the write
and check
CLI subcommands use, and you can
compose those as you need
FAQs
Tooling to document best practices in your code base.
The npm package @closeio/best-practices-documentation receives a total of 22 weekly downloads. As such, @closeio/best-practices-documentation popularity was classified as not popular.
We found that @closeio/best-practices-documentation demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.