Skip to content

Commit

Permalink
chore: eslint migration (#453)
Browse files Browse the repository at this point in the history
## Description

```
> eslint src && prettier . --check


Oops! Something went wrong! :(

ESLint: [9](https://github.com/defenseunicorns/kubernetes-fluent-client/actions/runs/11673947912/job/32505660897?pr=399#step:5:10).14.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

npx @eslint/migrate-config .eslintrc.json

Migrating .eslintrc.json

Wrote new config to ./eslint.config.mjs

You will need to install the following packages to use the new config:
- globals
- @eslint/js
- @eslint/eslintrc

You can install them using the following command:

npm install globals @eslint/js @eslint/eslintrc -D
```

## Related Issue

Fixes #452 

<!-- or -->

Relates to #

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request)
followed

---------

Signed-off-by: Case Wylie <[email protected]>
  • Loading branch information
cmwylie19 authored Nov 5, 2024
1 parent 5151ede commit 8418b43
Show file tree
Hide file tree
Showing 3 changed files with 205 additions and 41 deletions.
66 changes: 66 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
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: ["**/node_modules", "**/dist", "**/__mocks__", "e2e/crds", "e2e/crds"],
},
...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsdoc/recommended-typescript-error",
),
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, "off"])),
},

parser: tsParser,
ecmaVersion: 2022,
sourceType: "script",

parserOptions: {
project: ["tsconfig.json"],
},
},

rules: {
"class-methods-use-this": "warn",
"consistent-this": "warn",
"no-invalid-this": "warn",

"@typescript-eslint/no-floating-promises": [
"warn",
{
ignoreVoid: true,
},
],

"jsdoc/tag-lines": [
"error",
"any",
{
startLines: 1,
},
],
},
},
];
177 changes: 136 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
"devDependencies": {
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@jest/globals": "29.7.0",
"@types/byline": "4.2.36",
"@types/readable-stream": "4.0.18",
Expand All @@ -57,6 +59,7 @@
"@typescript-eslint/eslint-plugin": "8.13.0",
"@typescript-eslint/parser": "8.13.0",
"eslint-plugin-jsdoc": "50.4.3",
"globals": "^15.12.0",
"husky": "^9.1.6",
"jest": "29.7.0",
"lint-staged": "^15.2.10",
Expand Down

0 comments on commit 8418b43

Please sign in to comment.