@australiangreens/eslint-plugin-ag-internal
v0.3.4
Published
Internal linting configuration
Readme
eslint-plugin-ag-internal
A collection of eslint rules we use across our JS and TS applications.
This is intended to strictly be an ESM-only package for eslint 9+ with the flat config. No attempt has been made for backwards compatibility.
Usage
There is a single peer dependency eslint version 9.26.0 or above.
In a simple React application with a standard structure the minimal
eslint.config.js file will look like:
import agLintPlugin from '@australiangreens/eslint-plugin-ag-internal';
export default agLintPlugin.configs.recommendedReact;For more control over the ignored files etc, you may need something more like:
import agLintPlugin from '@australiangreens/eslint-plugin-ag-internal';
import { defineConfig, globalIgnores } from 'eslint/config';
import globals from 'globals';
export default defineConfig([
globalIgnores(['**/node_modules', '**/dist', '**/coverage']),
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
globals: {
...globals.jest,
...globals.vitest,
// globals.node and globals.browser will be merged in automatically
},
},
},
agLintPlugin.configs.recommendedReact,
]);Configs
There are 4 configs: recommended, recommendedReact, recommendJsOnly and
recommendedReactJsOnly. Since we primarily use typescript, typically we'll
only be using the first 2.
In all configs the rules are enabled as errors with the exception of ones in
the react-you-might-not-need-an-effect/ namespace, which are currently only
warnings. This may be changed in the future.
recommendedJsOnly
Includes
globals.node.eslint js plugin's recommended rules with some changes to
radixandno-plusplus.import plugin's recommended rules with the addition of 2 strict rules.
recommended
All the rules from recommendedJsOnly with the addition of the following:
typescript-eslint plugin's recommended rules with some small tweaks.
tsdoc plugin's single
tsdoc/syntaxrule enabled as error.import typescript rules.
recommendedReactJsOnly
recommendedJsOnly with the addition of the following:
Includes
globals.browser.jsx-a11y plugin's strict rules with some extras that won't be enabled by default until a later version of the plugin.
react plugin's recommended rules with an increase in strictness of the
react/destructuring-assignmentrule.react plugin's jsx-runtime rules.
react-hooks plugin's recommended rules as errors.
react-refresh plugin's single rule.
react-you-might-not-need-an-effect's recommended rules (as warnings, not errors).
recommendedReact
All the rules in recommendedReactJsOnly with the new ones that recommended brings.
