From 7fc6cc71cd844fabd1363a448cc1f025240395b8 Mon Sep 17 00:00:00 2001 From: Steven Noorbergen <91969936+steven-noorbergen@users.noreply.github.com> Date: Sun, 3 Mar 2024 16:08:21 +0100 Subject: [PATCH] chore(eslint/prettier): Update config to apply to all relevant files (#67) --- .eslintignore | 5 + .eslintrc.js | 33 ++--- .storybook/fits.ts | 350 ++++++++++++++++++++++----------------------- .storybook/main.ts | 17 +-- package.json | 4 +- src/types.d.ts | 4 +- tsconfig.json | 6 +- 7 files changed, 212 insertions(+), 207 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..647e98e --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +!.storybook/ +dist/ +node_modules/ +src/EveDataProvider/esf_pb2.js +src/EveDataProvider/protobuf.js diff --git a/.eslintrc.js b/.eslintrc.js index d3fd280..36e9300 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,4 @@ -const path = require("path") +const path = require("path"); module.exports = { env: { @@ -16,16 +16,11 @@ module.exports = { "plugin:storybook/recommended", "prettier", ], - plugins: [ - "@typescript-eslint", - "import", - "prettier", - "react", - ], - "settings": { - "react": { - "version": "detect" - } + plugins: ["@typescript-eslint", "import", "prettier", "react"], + settings: { + react: { + version: "detect", + }, }, rules: { "newline-per-chained-call": "off", @@ -35,9 +30,15 @@ module.exports = { parserOptions: { project: "./tsconfig.json", }, - ignorePatterns: [ - "src/EveDataProvider/esf_pb2.js", - "src/EveDataProvider/protobuf.js", + ignorePatterns: ["src/EveDataProvider/esf_pb2.js", "src/EveDataProvider/protobuf.js"], + overrides: [ + { + // The files listed below are part of the build process, so they will be using packages that are listed + // under devDependences and/or peerDependencies, so we need to be lenient with the import/no-extraneous-dependencies + files: [".storybook/**/*.ts", ".eslintrc.js", "rollup.config.mjs"], + rules: { + "import/no-extraneous-dependencies": ["error", { peerDependencies: true, devDependencies: true }], + }, + }, ], - overrides: [], -} +}; diff --git a/.storybook/fits.ts b/.storybook/fits.ts index 75a6706..441af73 100644 --- a/.storybook/fits.ts +++ b/.storybook/fits.ts @@ -1,4 +1,3 @@ - export const eftFit = `[Loki,Loki basic PVE] Caldari Navy Ballistic Control System Caldari Navy Ballistic Control System @@ -31,185 +30,186 @@ Loki Propulsion - Wake Limiter Hammerhead II x1 `; -export const hashFit = "fit:v1:H4sIAAAAAAAAClXOMQ7CMAwF0L2n6AE8xD92bLMiRhi4AQMSrND7i7itGrG9JHb+R4QLnet8fyzL8zOf5tv7+7pcaWIoiTY04u7WrcGrLe/LZk+zppkA7CODdTBIGOydKFTVoiRzzfMdIFZrmYdKHOyWlEEdW0ZQW3N7hYNxsJZBHsRgL+ammRagypZBU9RO3yid1bKuEkRyylDy0CxIxTBthXQdScmmIt7I/+72D6JNPx7qugdyAQAA"; +export const hashFit = + "fit:v1:H4sIAAAAAAAAClXOMQ7CMAwF0L2n6AE8xD92bLMiRhi4AQMSrND7i7itGrG9JHb+R4QLnet8fyzL8zOf5tv7+7pcaWIoiTY04u7WrcGrLe/LZk+zppkA7CODdTBIGOydKFTVoiRzzfMdIFZrmYdKHOyWlEEdW0ZQW3N7hYNxsJZBHsRgL+ammRagypZBU9RO3yid1bKuEkRyylDy0CxIxTBthXQdScmmIt7I/+72D6JNPx7qugdyAQAA"; export const fullFit = { - "name": "C3 Ratter : NishEM", - "ship_type_id": 29984, - "description": "", - "items": [ - { - "flag": 125, - "quantity": 1, - "type_id": 45626 + name: "C3 Ratter : NishEM", + ship_type_id: 29984, + description: "", + items: [ + { + flag: 125, + quantity: 1, + type_id: 45626, + }, + { + flag: 126, + quantity: 1, + type_id: 45591, + }, + { + flag: 127, + quantity: 1, + type_id: 45601, + }, + { + flag: 128, + quantity: 1, + type_id: 45615, + }, + { + flag: 11, + quantity: 1, + type_id: 22291, + }, + { + flag: 12, + quantity: 1, + type_id: 22291, + }, + { + flag: 13, + quantity: 1, + type_id: 22291, + }, + { + flag: 19, + quantity: 1, + type_id: 41218, + }, + { + flag: 20, + quantity: 1, + type_id: 35790, + }, + { + flag: 21, + quantity: 1, + type_id: 2281, + }, + { + flag: 22, + quantity: 1, + type_id: 15766, + }, + { + flag: 23, + quantity: 1, + type_id: 19187, + }, + { + flag: 24, + quantity: 1, + type_id: 19187, + }, + { + flag: 25, + quantity: 1, + type_id: 35790, + }, + { + flag: 27, + quantity: 1, + type_id: 25715, + charge: { + type_id: 20308, }, - { - "flag": 126, - "quantity": 1, - "type_id": 45591 + }, + { + flag: 28, + quantity: 1, + type_id: 25715, + charge: { + type_id: 20308, }, - { - "flag": 127, - "quantity": 1, - "type_id": 45601 + }, + { + flag: 29, + quantity: 1, + type_id: 25715, + charge: { + type_id: 20308, }, - { - "flag": 128, - "quantity": 1, - "type_id": 45615 + }, + { + flag: 30, + quantity: 1, + type_id: 25715, + charge: { + type_id: 20308, }, - { - "flag": 11, - "quantity": 1, - "type_id": 22291 + }, + { + flag: 31, + quantity: 1, + type_id: 25715, + charge: { + type_id: 20308, }, - { - "flag": 12, - "quantity": 1, - "type_id": 22291 + }, + { + flag: 32, + quantity: 1, + type_id: 25715, + charge: { + type_id: 20308, }, - { - "flag": 13, - "quantity": 1, - "type_id": 22291 - }, - { - "flag": 19, - "quantity": 1, - "type_id": 41218 - }, - { - "flag": 20, - "quantity": 1, - "type_id": 35790 - }, - { - "flag": 21, - "quantity": 1, - "type_id": 2281 - }, - { - "flag": 22, - "quantity": 1, - "type_id": 15766 - }, - { - "flag": 23, - "quantity": 1, - "type_id": 19187 - }, - { - "flag": 24, - "quantity": 1, - "type_id": 19187 - }, - { - "flag": 25, - "quantity": 1, - "type_id": 35790 - }, - { - "flag": 27, - "quantity": 1, - "type_id": 25715, - "charge": { - "type_id": 20308 - } - }, - { - "flag": 28, - "quantity": 1, - "type_id": 25715, - "charge": { - "type_id": 20308 - } - }, - { - "flag": 29, - "quantity": 1, - "type_id": 25715, - "charge": { - "type_id": 20308 - } - }, - { - "flag": 30, - "quantity": 1, - "type_id": 25715, - "charge": { - "type_id": 20308 - } - }, - { - "flag": 31, - "quantity": 1, - "type_id": 25715, - "charge": { - "type_id": 20308 - } - }, - { - "flag": 32, - "quantity": 1, - "type_id": 25715, - "charge": { - "type_id": 20308 - } - }, - { - "flag": 33, - "quantity": 1, - "type_id": 28756 - }, - { - "flag": 92, - "quantity": 1, - "type_id": 31724 - }, - { - "flag": 93, - "quantity": 1, - "type_id": 31824 - }, - { - "flag": 94, - "quantity": 1, - "type_id": 31378 - }, - { - "flag": 5, - "quantity": 3720, - "type_id": 24492 - }, - { - "flag": 5, - "quantity": 5472, - "type_id": 2679 - }, - { - "flag": 5, - "quantity": 1, - "type_id": 35795 - }, - { - "flag": 5, - "quantity": 1, - "type_id": 35794 - }, - { - "flag": 5, - "quantity": 8, - "type_id": 30486 - }, - { - "flag": 5, - "quantity": 1, - "type_id": 35794 - }, - { - "flag": 5, - "quantity": 396, - "type_id": 24492 - } - ] - }; + }, + { + flag: 33, + quantity: 1, + type_id: 28756, + }, + { + flag: 92, + quantity: 1, + type_id: 31724, + }, + { + flag: 93, + quantity: 1, + type_id: 31824, + }, + { + flag: 94, + quantity: 1, + type_id: 31378, + }, + { + flag: 5, + quantity: 3720, + type_id: 24492, + }, + { + flag: 5, + quantity: 5472, + type_id: 2679, + }, + { + flag: 5, + quantity: 1, + type_id: 35795, + }, + { + flag: 5, + quantity: 1, + type_id: 35794, + }, + { + flag: 5, + quantity: 8, + type_id: 30486, + }, + { + flag: 5, + quantity: 1, + type_id: 35794, + }, + { + flag: 5, + quantity: 396, + type_id: 24492, + }, + ], +}; diff --git a/.storybook/main.ts b/.storybook/main.ts index 5b593db..63721a6 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,12 +1,9 @@ import type { StorybookConfig } from "@storybook/react-webpack5"; +import type { Configuration } from "webpack"; const config: StorybookConfig = { stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], - addons: [ - "@storybook/addon-links", - "@storybook/addon-essentials", - "@storybook/addon-interactions", - ], + addons: ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-interactions"], framework: { name: "@storybook/react-webpack5", options: {}, @@ -17,13 +14,13 @@ const config: StorybookConfig = { core: { disableTelemetry: true, }, - webpackFinal: async (config: any) => { + webpackFinal: async (webpackConfig: Configuration) => { return { - ...config, + ...webpackConfig, experiments: { - asyncWebAssembly: true - } - } + asyncWebAssembly: true, + }, + }; }, }; export default config; diff --git a/package.json b/package.json index 0d3037f..6d92914 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "build": "rollup -c", "build-storybook": "storybook build", "dev": "storybook dev -p 6006 --no-open", - "lint": "eslint src --ext .js,.tsx --cache && prettier -c src", - "prettier": "prettier -w src" + "lint": "eslint .storybook src --ext .js,.ts,.tsx --cache && prettier -c .storybook src", + "prettier": "prettier -w .storybook src" }, "repository": { "type": "git", diff --git a/src/types.d.ts b/src/types.d.ts index 62fd255..f2d12bb 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,4 +1,4 @@ declare module "*.module.css" { - const css: any; - export default css; + const classes: { [key: string]: string }; + export default classes; } diff --git a/tsconfig.json b/tsconfig.json index e99c93e..c0618a0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,8 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "es2016", - } + "target": "es2016" + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", ".storybook/*.ts"], + "exclude": ["node_modules"] }