Skip to content

Commit

Permalink
Fix(design-tokens): Fix eslint configuration #DS-1503
Browse files Browse the repository at this point in the history
  • Loading branch information
curdaj committed Oct 8, 2024
1 parent b5817f0 commit ad45fa3
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
'!.*.js',
'packages/analytics',
'packages/common',
'packages/design-tokens',
'packages/web-react',
'packages/web',
'packages/form-validations',
Expand Down
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ CODEOWNERS

# variable-scss exporter generated cjs
exporters/variables-scss/generated/**/*.cjs

# design-tokens generated files
packages/design-tokens/src/**/*.ts
packages/design-tokens/src/**/*.scss
18 changes: 18 additions & 0 deletions packages/design-tokens/.eslintignore
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions packages/design-tokens/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = {
extends: [
'../../.eslintrc',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'@lmc-eu/eslint-config-jest',
],

parser: '@typescript-eslint/parser', // the TypeScript parser we installed earlier

parserOptions: {
ecmaVersion: 'latest',
project: './tsconfig.eslint.json',
},

settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts'],
},
},
},

plugins: ['promise', '@typescript-eslint', 'prettier'],
rules: {
// disable for `scripts` and `config`
'@typescript-eslint/no-var-requires': 'off',
// allow ++ in for loops
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
// disabled due to typescript
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error', { allow: ['resolve', 'reject', 'done', 'next', 'error'] }],
// disabled due to typescript
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'warn',
// We are using typescript, disable jsdoc rules
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-param-type': 'off',
// allow reassign in properties
'no-param-reassign': ['warn', { props: false }],
// support monorepos
'import/no-extraneous-dependencies': ['error', { packageDir: ['./', '../../'] }],
},
};
4 changes: 3 additions & 1 deletion packages/design-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"build:js": "vite build",
"build:scss": "shx mkdir -p scss && shx cp -r src/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"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/design-tokens/tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["./", "./.eslintrc.cjs"]
}

0 comments on commit ad45fa3

Please sign in to comment.