![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@eox/eslint-config
Advanced tools
This reusable config aims to be our default way of setting up linting and formatting for JS projects. It includes:
The config also includes a minimal set of rules, defined in index.js.
npm install --save-dev @eox/eslint-config
To run prettier and format all your files in the current folder, use
npx prettier --write .
or
npx prettier --write "**/*"
Please refer to the Prettier CLI docs for further details.
To include ESLint in the project, create a file called eslint.config.mjs
in the app root:
import eox from "@eox/eslint-config";
export default [...eox];
Finally, to run ESLint with auto-fixing, use
npx eslint --fix .
Please refer to the ESLint configuration docs and ESLint CLI docs for further details.
To use typescript checks, create a tsconfig.json
in the project root
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
...
}
}
and run the check with
npx tsc
not any longer -> only for prettier?
You can add a .prettierignore file to ignore certain folders or files/patterns.
E.g.:
public
dist
*.min.js
*.bundle.js
# adapt according to your project needs
For ESlint, use the ignores
property in the config file. Example:
// other config
{ ignores: ["dist"] },
// other config
Both Prettier and ESLint allow for some rule customization. Please check the Prettier configuration options and the ESLint rules for an explanation of rules that could be added/modified to this file for individual projects.
BUT: please consider if this is really necessary, or if it could be included in the centralized config rather than in an individual project. Ideally, the individual projects should not use any custom rules.
Example: Cypress & Vue
// eslint.config.js
import eox from "@eox/eslint-config";
import pluginCypress from "eslint-plugin-cypress/flat";
import pluginVue from "eslint-plugin-vue";
export default [
...eox,
pluginCypress.configs.recommended,
...pluginVue.configs["flat/recommended"],
{
rules: {
// override/add rules settings here
},
},
];
To check if your code is valid before committing or inside a CI pipeline, use
npx prettier --check .
npx eslint .
Although you can use prettier via command line, in a pre-commit hook or in a CI pipeline, you can also use the VS Code extension to format files (or file sections) via a handy command or even automatically (e.g. on file save) right inside your code editor.
--> Prettier - Code formatter extension
Please refer to the description about setting up and using the extension!
As a bare minimum, create a .prettierrc.json
file in the app root to let the editor know prettier is used in this project
echo {} > .prettierrc.json
As for ESLint, automatically running and fixing your code can be obtained by changing the settings in your workspace or dev container settings, e.g.:
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
FAQs
EOX Prettier and ESLint config for JS projects
The npm package @eox/eslint-config receives a total of 52 weekly downloads. As such, @eox/eslint-config popularity was classified as not popular.
We found that @eox/eslint-config demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
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.