@allenai/eslint-config-varnish
v3.0.0
Published
Common linting and formatting configuration for Varnish projects.
Keywords
Readme
ESLint Config Varnish
The files in this directory represent the eslint configuration settings for Varnish.
This version of the package is compatible with ESlint 10 and the new "flat" configs.
For more information about the new "flat" config format, see this documentation. For more information about migrating to version 10, see this documentation.
They will be published as a separate NPM module, @allenai/eslint-config-varnish.
This allows them to be shared easily across multiple AI2 projects.
For more information about publishing and using shared eslint configuration
definitions, see this documentation.
Usage
Install it and its peer dependencies:
~ yarn add -D \ @allenai/eslint-config-varnish \ @eslint-react/eslint-plugin \ @eslint/js \ @eslint/json \ eslint \ eslint-plugin-jsx-a11y \ eslint-plugin-react-refresh \ typescript \ typescript-eslint \Optionally, you can also install Prettier deps, if you want to use the Prettier config included in this package:
~ yarn add -D \ prettier \ eslint-config-prettier \ eslint-plugin-prettier \Create a "flat" config file, and configure
eslintto use this package as a base:import { defineConfig, globalIgnores } from 'eslint/config'; import varnish from '@allenai/eslint-config-varnish'; export default defineConfig([ // Remove any old .eslintignore files and add patterns here instead globalIgnores(['dist/**', 'build/**', 'playwright-report/**', 'playwright/.cache/**']), // Use the recommended Varnish config as a base, and add custom rules on top of it varnish.configs.recommendedWithReact, // or varnish.configs.strictWithReact for a stricter set of rules { /** * Add custom rules here, or override rules from the base config. For example: */ rules: { 'prettier/prettier': ['error', { singleQuote: true }], }, }, /** * if you have an older eslint config that you want to migrate into * this file, you may add more sections to this array, and copy * over rules from your old config, and remove any old config files. */ varnishConfig.configs.prettier, // Prettier should be last (optional) ]);Add targets for linting and reformatting code to your
package.jsonfile:"scripts": { "lint": "eslint . && echo '💫 Lint complete.'", "lint:fix": "eslint . --fix && echo '🛠 Lint --fix complete.'", }Try it out:
# See what's wrong ~ yarn lint # Reformat and fix things ~ yarn lint:fix
Documentation
Contributing
See instructions at the monorepo root CONTRIBUTING
