Skip to content

Commit

Permalink
build(eslint, tsconfig): move base configs to separate workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Jul 7, 2023
1 parent de33afd commit 2445bd5
Show file tree
Hide file tree
Showing 20 changed files with 5,076 additions and 4,908 deletions.
19 changes: 0 additions & 19 deletions .lintstagedrc.cjs

This file was deleted.

6 changes: 6 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"*.{json,html,yml}": ["prettier --write"],
"*.scss": ["stylelint --fix", "prettier --write"],
"packages/**/*.{ts,tsx}": ["eslint --ext .ts,.tsx --fix", "prettier --write"],
"*.md": ["markdownlint --fix --disable MD024 MD013 MD041 MD033", "prettier --write"]
}
77 changes: 77 additions & 0 deletions configs/eslint/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.export = {
extends: ["plugin:@typescript-eslint/recommended", "plugin:jsdoc/recommended", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: [
"./tsconfig-eslint.json",
"./packages/*/tsconfig-eslint.json",
"./tsconfig.json",
"./packages/*/tsconfig.json"
],
ecmaVersion: 2021,
},
plugins: ["@typescript-eslint", "import", "jsdoc", "prettier", "unicorn"],
rules: {
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
allowArgumentsExplicitlyTypedAsAny: true,
allowedNames: [
"connectedCallback",
"disconnectedCallback",
"componentWillRender",
"componentDidRender",
"componentWillLoad",
"componentDidLoad",
"componentWillUpdate",
"componentDidUpdate",
"render"
]
}
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "error",
curly: "error",
"import/no-dynamic-require": ["error", { esmodule: true }],
"jsdoc/check-tag-names": "off",
"jsdoc/require-jsdoc": "off",
"jsdoc/tag-lines": ["error", "any", { startLines: 1 }],
"lines-between-class-members": ["error", "always"],
"no-eval": "error",
"no-implied-eval": "error",
"no-multiple-empty-lines": [
"error",
{
max: 1
}
],
"no-new-func": "error",
"no-unneeded-ternary": "error",
"unicorn/prefer-ternary": "error",
"unicorn/prevent-abbreviations": [
"error",
{
allowList: {
e2ePage: true
},
extendDefaultReplacements: false,
replacements: {
e: {
error: true,
event: true
}
},
checkProperties: false,
checkFilenames: false
}
]
},
settings: {
jsdoc: {
ignoreInternal: true,
ignorePrivate: true
}
}
};
16 changes: 16 additions & 0 deletions configs/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "eslint-config-calcite",
"private": true,
"version": "0.0.0",
"description": "Shared ESLint configuration for use in multiple packages",
"main": "index.js",
"dependencies": {
"@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "5.48.2",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsdoc": "46.2.6",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "46.0.0"
}
}
4 changes: 3 additions & 1 deletion ...ges/calcite-components/tsconfig-base.json → configs/tsconfig/base.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
Expand All @@ -13,5 +14,6 @@
"noUnusedParameters": true,
"jsx": "react",
"jsxFactory": "h"
}
},
"exclude": ["node_modules", "dist"]
}
6 changes: 6 additions & 0 deletions configs/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "tsconfig",
"private": true,
"version": "0.0.0",
"description": "Shared TypeScript configuration for use in multiple packages"
}
Loading

0 comments on commit 2445bd5

Please sign in to comment.