Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(*): Fix eslint configs #2140

Merged
merged 18 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got an error that this file can be converted to an es module (the automatic migration does not work, but export default works for me)

Suggested change
module.exports = {
export default {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, it's not as easy as that. I think the error only appears in your IDE, but not the tools. We need to make a lot of changes so I created another ticket for that: #2167

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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convert to js to be able to use __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"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another error says that the eslint config file is not linted.

Suggested change
"include": ["src", "**/tests"],
"include": ["src", ".eslintrc.js", "**/tests"],

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot reproduce it. Where does the error appear?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only appears when the above suggestion is applied, so it will be fixed with #2167

"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
Loading