Skip to content

Commit

Permalink
chore: added linter for JSON files
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Dec 10, 2024
1 parent e96baef commit 4a55c6f
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ icons/
build-scss.js
component-generator/
example/
package-lock.json
src/i18n
dependent-usage.json
24 changes: 24 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ module.exports = {
}],
'no-param-reassign': [2, { props: false }],
},
overrides: [
{
files: ['**/*.json'],
parser: 'jsonc-eslint-parser',
extends: ['plugin:jsonc/recommended-with-json'],
rules: {
'jsonc/indent': ['error', 2],
'jsonc/quote-props': ['error', 'always'],
'jsonc/quotes': ['error', 'double'],
'jsonc/no-octal': 'error',
'jsonc/no-dupe-keys': 'error',
'jsonc/valid-json-number': 'error',
'jsonc/no-bigint-literals': 'error',
'jsonc/no-comments': 'off',
// Disabled @typescript-eslint rules for JSON files as they contain plain data structures
// unrelated to TypeScript syntax, semantics, or runtime behavior.
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/no-implied-eval': 'off',
'@typescript-eslint/no-throw-literal': 'off',
'@typescript-eslint/return-await': 'off',
},
},
],
env: {
jest: true,
},
Expand Down
183 changes: 156 additions & 27 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"commit": "commit",
"debug-test": "node --inspect-brk node_modules/.bin/jest --runInBand --coverage",
"stylelint": "stylelint \"src/**/*.scss\" \"scss/**/*.scss\" \"www/src/**/*.scss\" --config .stylelintrc.json",
"lint": "npm run stylelint && eslint --ext .js --ext .jsx --ext .ts --ext .tsx . && npm run lint --workspaces --if-present",
"lint": "npm run stylelint && eslint --ext .js --ext .jsx --ext .ts --ext .tsx --ext .json . && npm run lint --workspaces --if-present",
"prepublishOnly": "npm run build",
"semantic-release": "semantic-release",
"snapshot": "jest --updateSnapshot",
Expand Down Expand Up @@ -143,6 +143,7 @@
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsonc": "^2.18.1",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
Expand Down Expand Up @@ -201,7 +202,7 @@
]
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"*.{js,jsx,ts,tsx,json}": [
"npx eslint"
],
"*.scss": [
Expand Down
4 changes: 2 additions & 2 deletions tokens/src/core/global/typography.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"serif": {
"source": "$font-family-sans-serif",
"$value": ["-apple-system", "BlinkMacSystemFont", "Segoe UI", "Roboto", "Helvetica Neue", "Arial",
"Noto Sans", "sans-serif", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"],
"Noto Sans", "sans-serif", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"],
"$description": "Sans-serif font family."
}
},
Expand All @@ -23,7 +23,7 @@
},
"monospace": {
"source": "$font-family-monospace",
"$value": ["SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", "monospace"],
"$value": ["SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", "monospace"],
"$description": "Monospace font family."
}
},
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
},
"include": ["src"],
// Don't include the .test.tsx files when we build the .d.ts files in dist/
"exclude": ["src/**/*.test.tsx"],
"exclude": ["src/**/*.test.tsx"]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"algolia-docsearch/*",
"bin/*",
"dependent-usage-analyzer/**/*",
"tokens/**/*",
"tokens/**/*"
]
}

0 comments on commit 4a55c6f

Please sign in to comment.