From bd4326bb44263f4cbcc1f84f144bbcb8a09a941c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Curda?= Date: Mon, 7 Oct 2024 16:36:57 +0200 Subject: [PATCH] Fix(design-tokens): Fix eslint configuration #DS-1503 --- .eslintrc.js | 1 + packages/design-tokens/.eslintignore | 18 ++++++++++++++++++ packages/design-tokens/.eslintrc.cjs | 12 ++++++++++++ packages/design-tokens/.stylelintrc.mjs | 8 +++++++- packages/design-tokens/package.json | 4 +++- packages/design-tokens/tsconfig.eslint.json | 4 ++++ 6 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 packages/design-tokens/.eslintignore create mode 100644 packages/design-tokens/.eslintrc.cjs create mode 100644 packages/design-tokens/tsconfig.eslint.json diff --git a/.eslintrc.js b/.eslintrc.js index 2c33f56acf..85b42421ec 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,6 +21,7 @@ module.exports = { '!.*.js', 'packages/analytics', 'packages/common', + 'packages/design-tokens', 'packages/web-react', 'packages/web', 'packages/form-validations', diff --git a/packages/design-tokens/.eslintignore b/packages/design-tokens/.eslintignore new file mode 100644 index 0000000000..cc36ce8bf9 --- /dev/null +++ b/packages/design-tokens/.eslintignore @@ -0,0 +1,18 @@ +# .eslintignore + +node_modules + +# NOTE: +# The following directives are only relevant when linting the whole +# project directory, ie. running `eslint .` ⚠️ + +# If you compile JavaScript into some output folder, exclude it here +dist +build + +# Highly recommended to re-include JavaScript dotfiles to lint them +# (This will cause .eslintrc.js to be linted by ESLint 🤘) +!.*.js + +# Some tools use this pattern for their configuration files. Lint them! +!*.config.js diff --git a/packages/design-tokens/.eslintrc.cjs b/packages/design-tokens/.eslintrc.cjs new file mode 100644 index 0000000000..983c0137d9 --- /dev/null +++ b/packages/design-tokens/.eslintrc.cjs @@ -0,0 +1,12 @@ +module.exports = { + extends: ['../../.eslintrc', '@lmc-eu/eslint-config-typescript', '@lmc-eu/eslint-config-jest'], + + parserOptions: { + ecmaVersion: 'latest', + project: './tsconfig.eslint.json', + }, + + rules: { + 'prettier/prettier': 'off', + }, +}; diff --git a/packages/design-tokens/.stylelintrc.mjs b/packages/design-tokens/.stylelintrc.mjs index 65dd50243e..982d670bc9 100644 --- a/packages/design-tokens/.stylelintrc.mjs +++ b/packages/design-tokens/.stylelintrc.mjs @@ -1,3 +1,9 @@ import stylelintConfig from 'stylelint-config-spirit'; -export default stylelintConfig; +export default { + ...stylelintConfig, + + rules: { + 'prettier/prettier': null, + }, +}; diff --git a/packages/design-tokens/package.json b/packages/design-tokens/package.json index 128f57bb16..72e102581d 100644 --- a/packages/design-tokens/package.json +++ b/packages/design-tokens/package.json @@ -30,7 +30,9 @@ "build:js": "vite build", "build:scss": "shx mkdir -p scss && shx cp -r src/scss/generated/* src/scss/@tokens.scss scss/", "clean": "rimraf esm cjs umd scss types", - "lint": "stylelint ./src/**/*.scss", + "lint": "npm-run-all --serial lint:scripts lint:styles", + "lint:scripts": "eslint ./src/**/*.ts", + "lint:styles": "stylelint ./src/**/*.scss", "test": "yarn lint", "types": "tsc" }, diff --git a/packages/design-tokens/tsconfig.eslint.json b/packages/design-tokens/tsconfig.eslint.json new file mode 100644 index 0000000000..07094afeb3 --- /dev/null +++ b/packages/design-tokens/tsconfig.eslint.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["./", "./.eslintrc.cjs"] +}