Skip to content

Commit

Permalink
Migrate ESlint to flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Jul 30, 2024
1 parent aedbb48 commit 2cf59e5
Show file tree
Hide file tree
Showing 5 changed files with 312 additions and 61 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

56 changes: 0 additions & 56 deletions .eslintrc.js

This file was deleted.

110 changes: 110 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import jsdoc from "eslint-plugin-jsdoc";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ["lib/thirdparty/"],
},
...compat.extends("eslint:recommended", "google"),
{
plugins: {
jsdoc,
},

languageOptions: {
globals: {
...globals.node,
},

ecmaVersion: 8,
sourceType: "commonjs",
},

settings: {
jsdoc: {
tagNamePreference: {
return: "returns",
},
},
},

rules: {
indent: ["error", "tab"],
"linebreak-style": ["error", "unix"],

quotes: [
"error",
"double",
{
allowTemplateLiterals: true,
},
],

semi: ["error", "always"],
"no-negated-condition": "off",
"require-jsdoc": "off",
"no-mixed-requires": "off",

"max-len": [
"warn", // TODO: set to "error" and fix all findings
{
code: 120,
ignoreUrls: true,
ignoreRegExpLiterals: true,
},
],

"no-implicit-coercion": [
2,
{
allow: ["!!"],
},
],

"comma-dangle": "off",
"no-tabs": "off",

"valid-jsdoc": 0,
// Starting with ESLint v8, it needs to be disabled as it currently can't be supported
// See: https://github.com/eslint/eslint/issues/14745
"jsdoc/check-examples": 0,
"jsdoc/check-param-names": 2,
"jsdoc/check-tag-names": 2,
"jsdoc/check-types": 2,
"jsdoc/no-undefined-types": 0,
"jsdoc/require-description": 0,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/require-example": 0,
"jsdoc/require-hyphen-before-param-description": 0,
"jsdoc/require-param": 2,
"jsdoc/require-param-description": 0,
"jsdoc/require-param-name": 2,
"jsdoc/require-param-type": 2,
"jsdoc/require-returns": 0,
"jsdoc/require-returns-description": 0,
"jsdoc/require-returns-type": 2,

"jsdoc/tag-lines": [
2,
"any",
{
startLines: 1,
},
],

"jsdoc/valid-types": 0,
},
},
];
Loading

0 comments on commit 2cf59e5

Please sign in to comment.