@fluid-project/eslint-config-infusion-6
v1.0.0
Published
The ESLint configuration of Infusion 6 - the rules of eslint-config-fluid, which it replaces, with Infusion's own settings, as an ESLint flat configuration
Keywords
Readme
@fluid-project/eslint-config-infusion-6
The ESLint configuration of Infusion 6, as a flat configuration for ESLint 10. It replaces
eslint-config-fluid 2.1.1, together with the settings that
Infusion's own .eslintrc.json made over it, and keeps the effective settings they gave.
- eslint-config-fluid's rules, at the same severities and options. Its formatting rules, deprecated in ESLint's
core, come from @stylistic/eslint-plugin. Wherever @stylistic's defaults differ from the
core's, the core's behaviour is stated:
SwitchCase: 0forindent, and the core's exceptions forcomma-style. - Its JSDoc rules, through eslint-plugin-jsdoc, in
"jsdoc"mode as version 39 used. Infusion's own setting prefersanyoverAny. - Its environments as globals: the browser's and jQuery's, plus
fluidand$. - Infusion's own settings:
strictis set to"global".no-consoleandno-loop-funcare off.- Double quotes are required, but template literals are allowed, and so are single quotes to avoid escaping.
- ECMAScript 2022 is used, with
.jsfiles parsed as scripts.
- fluid-lint's rules, plus its processor for Single File Components, from eslint-plugin-fluid-lint.
Some defaults changed between ESLint 8 and 10, and the old behaviour is kept:
no-unused-varsdoesn't report an unused caught error.- An unused
eslint-disablecomment isn't reported.
Use
"use strict";
const infusion = require("@fluid-project/eslint-config-infusion-6");
module.exports = [
{ignores: ["**/lib/**"]},
...infusion.recommended,
// Files run by node: CommonJS, with node's globals - what /* eslint-env node */ once declared
{files: ["bin/**/*.js"], ...infusion.node},
// ES modules
{files: ["src/esm/**/*.js"], ...infusion.module},
// Other environments, from the globals package, which this package re-exports
{files: ["extension/**/*.js"], languageOptions: {globals: infusion.globals.webextensions}}
];ESLint 10 reports /* eslint-env */ comments as errors, so environments must be given in the configuration, by file.
Infusion's own eslint.config.js is a complete example.
Installation
The package is released from this repository with Infusion's other packages, as a tarball attached to its GitHub
release, e.g. @fluid-project/[email protected] - see the releases. A project installs
it, and the two packages it requires, which it names as peer dependencies, by the URLs of their tarballs, together
with ESLint 10:
"devDependencies": {
"eslint": "10.15.0",
"@fluid-project/fluid-lint": "https://github.com/fluid-project/infusion-6/releases/download/%40fluid-project/fluid-lint%401.0.0/fluid-project-fluid-lint-1.0.0.tgz",
"@fluid-project/eslint-plugin-fluid-lint": "https://github.com/fluid-project/infusion-6/releases/download/%40fluid-project/eslint-plugin-fluid-lint%401.0.0/fluid-project-eslint-plugin-fluid-lint-1.0.0.tgz",
"@fluid-project/eslint-config-infusion-6": "https://github.com/fluid-project/infusion-6/releases/download/%40fluid-project/eslint-config-infusion-6%401.0.0/fluid-project-eslint-config-infusion-6-1.0.0.tgz"
}The peer dependencies must be named so, since they are not in the npm registry, from which npm would otherwise install
them. node scripts/useRelease.js <project> points a project which names them at the versions of this checkout.
fluid-lint's summary formatter, as npm run lint uses it, is
./node_modules/@fluid-project/fluid-lint/eslint-summary-formatter.cjs. Within this repository the three are
workspaces, linked into node_modules/@fluid-project/ by npm install.
