Skip to content

Commit

Permalink
chore(*): Fix eslint configs (#2140)
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp Gfeller <[email protected]>
  • Loading branch information
imagoiq and gfellerph authored Oct 31, 2023
1 parent fc492b5 commit 29888b9
Show file tree
Hide file tree
Showing 18 changed files with 223 additions and 232 deletions.
2 changes: 0 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
{
// Fixes tsconfig not found error in nested .eslintrc.json files with relative paths
"eslint.workingDirectories": ["packages/intranet-header-workspace"]
}
2 changes: 2 additions & 0 deletions packages/components-react/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
src/components/stencil-generated
45 changes: 25 additions & 20 deletions packages/components-react/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
{
"env": {
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
"env": {
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
}
}
5 changes: 5 additions & 0 deletions packages/components/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
dist
loader
www
.stencil
cypress
stencil.config.ts
cypress.config.js
.eslintrc.js
77 changes: 77 additions & 0 deletions packages/components/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
env: {
browser: true,
node: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@stencil-community/recommended',
],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
tsconfigRootDir: __dirname,
project: 'tsconfig.eslint.json',
},
plugins: ['@typescript-eslint'],
rules: {
'indent': [
'error',
2,
{
SwitchCase: 1,
},
],
'quotes': ['error', 'single'],
'semi': ['error', 'always'],
'@typescript-eslint/no-unused-vars': [
'error',
{
caughtErrors: 'none',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@stencil-community/strict-boolean-conditions': 'off',
'@stencil-community/required-prefix': ['error', ['post-']],
'@stencil-community/async-methods': 'error',
'@stencil-community/decorators-context': 'error',
'@stencil-community/decorators-style': [
'error',
{
prop: 'inline',
state: 'inline',
element: 'inline',
event: 'inline',
method: 'multiline',
watch: 'multiline',
listen: 'multiline',
},
],
'@stencil-community/class-pattern': [
'error',
{
pattern: '^Post.*(?!Component)$',
},
],
'@stencil-community/element-type': 'error',
'@stencil-community/host-data-deprecated': 'error',
'@stencil-community/methods-must-be-public': 'error',
'@stencil-community/no-unused-watch': 'error',
'@stencil-community/own-methods-must-be-private': 'error',
'@stencil-community/own-props-must-be-private': 'error',
'@stencil-community/prefer-vdom-listener': 'error',
'@stencil-community/props-must-be-public': 'error',
'@stencil-community/props-must-be-readonly': 'error',
'@stencil-community/render-returns-host': 'error',
'@stencil-community/required-jsdoc': 'error',
'@stencil-community/reserved-member-names': 'error',
'@stencil-community/single-export': 'error',
'@stencil-community/strict-mutable': 'error',
'react/jsx-no-bind': 'off',
},
};
75 changes: 0 additions & 75 deletions packages/components/.eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions packages/components/cypress/e2e/collapsible.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('collapsible', () => {
cy.get('@collapse').should(`be.hidden`);
});

it("should adapt the header's aria-expanded attribute after collapsing", () => {
it('should adapt the header\'s aria-expanded attribute after collapsing', () => {
cy.get('@header').click();
cy.checkAriaExpanded('@collapse', 'false');
});
Expand All @@ -55,7 +55,7 @@ describe('collapsible', () => {
cy.get('@collapse').should(`be.visible`);
});

it("should adapt the header's aria-expanded attribute after expanding", () => {
it('should adapt the header\'s aria-expanded attribute after expanding', () => {
cy.get('@header').dblclick();
cy.checkAriaExpanded('@collapse', 'true');
});
Expand Down
4 changes: 2 additions & 2 deletions packages/components/cypress/e2e/tooltip.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ describe('tooltips', () => {
cy.wait(10);
cy.get('@tooltip')
.should('have.css', 'left')
.then((v: any) => {
expect(parseInt(v)).to.be.greaterThan(150);
.then((v: unknown) => {
expect(parseInt(v as string)).to.be.greaterThan(150);
});
});
});
Expand Down
9 changes: 2 additions & 7 deletions packages/components/tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"extends": "./tsconfig.json",
"include": [
"src",
"**/tests"
],
"exclude": [
"node_modules"
]
"include": ["src", "**/tests"],
"exclude": ["node_modules"]
}
2 changes: 2 additions & 0 deletions packages/demo/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.angular
dist
74 changes: 32 additions & 42 deletions packages/demo/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,41 @@
module.exports = {
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
root: true,
ignorePatterns: ['projects/**/*'],
overrides: [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json"
],
"tsconfigRootDir": __dirname,
"createDefaultProgram": true
files: ['*.ts'],
parserOptions: {
project: ['tsconfig.json'],
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
extends: [
'plugin:@angular-eslint/recommended',
'plugin:@angular-eslint/template/process-inline-templates',
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
rules: {
'@angular-eslint/directive-selector': [
'error',
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
type: 'attribute',
prefix: 'app',
style: 'camelCase',
},
],
"@angular-eslint/component-selector": [
"error",
'@angular-eslint/component-selector': [
'error',
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
type: 'element',
prefix: 'app',
style: 'kebab-case',
},
],
},
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
}
files: ['*.html'],
extends: ['plugin:@angular-eslint/template/recommended'],
rules: {},
},
],
};
10 changes: 10 additions & 0 deletions packages/internet-header/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.stencil
loader
www
dist
node_modules
stencil.config.ts
cypress.config.js
jest.config.js
src/assets
.eslintrc.js
23 changes: 23 additions & 0 deletions packages/internet-header/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
extends: ['plugin:@stencil-community/recommended'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
tsconfigRootDir: __dirname,
project: 'tsconfig.eslint.json',
},
rules: {
'@stencil-community/element-type': 1,
// Needed for DropdownElement
'@stencil/decorators-context': 0,
// This is a broken rule with eslint 8 (https://github.com/stencil-community/stencil-eslint/issues/60)
'@stencil/own-methods-must-be-private': 0,
// Seems to be buggy as well
'@stencil/async-methods': 0,
// Also buggy
'@stencil/no-unused-watch': 0,
// Buggy
'react/jsx-no-bind': 0,
// No performance problem anymore https://medium.com/@ryanflorence/react-inline-functions-and-performance-bdff784f5578
},
};
Loading

0 comments on commit 29888b9

Please sign in to comment.