Skip to content

Commit

Permalink
refactor(Importer): client eslint integration
Browse files Browse the repository at this point in the history
  • Loading branch information
seangwright committed Aug 2, 2023
1 parent 598361e commit ad4a0ee
Show file tree
Hide file tree
Showing 13 changed files with 4,968 additions and 410 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "**.props"
- "**.targets"
- "**.sln"
- "**/Client/**/*.json"
pull_request:
branches: [main]
paths:
Expand All @@ -21,6 +22,7 @@ on:
- "**.props"
- "**.targets"
- "**.sln"
- "**/Client/**/*.json"

jobs:
build:
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"davidanson.vscode-markdownlint",
"tintoy.msbuild-project-tools",
"esbenp.prettier-vscode",
"dotjoshjohnson.xml"
"dotjoshjohnson.xml",
"dbaeumer.vscode-eslint"
],
"unwantedRecommendations": []
}
13 changes: 12 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},

"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand All @@ -30,5 +33,13 @@
"files.associations": {
".azuredevops/**/*.yml": "azure-pipelines"
},
"dotnet.defaultSolution": "Kentico.Xperience.Contacts.Importer.sln"
"dotnet.defaultSolution": "Kentico.Xperience.Contacts.Importer.sln",

"eslint.workingDirectories": [
"./src/Kentico.Xperience.Contacts.Importer/Client"
],

"[aspnetcorerazor]": {
"editor.defaultFormatter": "ms-dotnettools.csharp"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
webpack.config.js
163 changes: 163 additions & 0 deletions src/Kentico.Xperience.Contacts.Importer/Client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"standard-with-typescript",
"prettier"
],
"overrides": [],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"@typescript-eslint/no-invalid-void-type": ["off"],
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"jsx-quotes": ["error", "prefer-double"],
"eqeqeq": ["error", "always"],
"no-var": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_",
"args": "after-used"
}
],
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-debugger": "error",
"import/first": "error",
"sort-imports": ["error", { "ignoreDeclarationSort": true }],
"import/order": [
"error",
{
"newlines-between": "never",
"pathGroups": [
{
"pattern": "./**.scss",
"group": "index",
"position": "after"
}
],
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"import/no-default-export": "error",
"import/no-duplicates": "error",
"react/prefer-es6-class": ["error", "always"],
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["PascalCase"],
"filter": {
"regex": "^((data|aria|xp|invalid|--[a-z]+)[-].+)|[0-9]+$",
"match": false
}
},
{
"selector": "variable",
"format": ["PascalCase", "camelCase"]
},
{
"selector": "variable",
"format": ["UPPER_CASE"],
"filter": {
"regex": "^__[A-Za-z_]+__$",
"match": true
},
"leadingUnderscore": "requireDouble",
"trailingUnderscore": "requireDouble"
},
{
"selector": "function",
"format": ["camelCase"]
},
{
"selector": "parameter",
"format": ["camelCase"],
"leadingUnderscore": "allow"
},
{
"selector": "enum",
"format": ["PascalCase"]
},
{
"selector": "objectLiteralProperty",
"format": ["camelCase", "PascalCase"],
"filter": {
"regex": "^((data|aria|xp|invalid|--[a-z]+)[-].+)|[0-9]+$",
"match": false
}
},
{
"selector": "objectLiteralMethod",
"format": ["camelCase"]
},
{
"selector": "typeProperty",
"format": ["camelCase"],
"filter": {
"regex": "^(data)[-].+$",
"match": false
}
},
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": "classMethod",
"format": ["camelCase"]
},
{
"selector": "classProperty",
"format": ["camelCase"]
},
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": false
}
}
],
"@typescript-eslint/await-thenable": "warn",
"@typescript-eslint/prefer-enum-initializers": "error",
"@typescript-eslint/no-non-null-assertion": "error"
},
"settings": {
"react": {
"version": "18.2.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"arrowParens": "always",
"singleQuote": true,
"semi": true
}
47 changes: 23 additions & 24 deletions src/Kentico.Xperience.Contacts.Importer/Client/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"useESModules": true
}
]
],
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": "current node"
}
]
]
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"useESModules": true
}
]
],
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": "current node"
}
]
]
}
}
}
Loading

0 comments on commit ad4a0ee

Please sign in to comment.