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(*): Sync linting and IDE config #2137

Merged
merged 15 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ bower_components/
package-lock.json
yarn.lock

# IDEs and editors
.idea/

Comment on lines -9 to -11
Copy link
Contributor Author

Choose a reason for hiding this comment

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

.idea contain already a generated gitignore that manage what can be sync with a team and what shoudn't.

# Log files
.pnpm-debug.log
lerna-debug.log
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

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

67 changes: 67 additions & 0 deletions .idea/codeStyles/Project.xml

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

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

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

22 changes: 22 additions & 0 deletions .idea/design-system.iml

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

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

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

7 changes: 7 additions & 0 deletions .idea/jsLinters/eslint.xml

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

6 changes: 6 additions & 0 deletions .idea/misc.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

9 changes: 9 additions & 0 deletions .idea/prettier.xml

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

6 changes: 6 additions & 0 deletions .idea/stylesheetLinters/stylelint.xml

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

6 changes: 6 additions & 0 deletions .idea/templateLanguages.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"jsxSingleQuote": false,
"trailingComma": "all",
"bracketSpacing": true,
"bracketLine": false,
"jsxBracketSameLine": false,
"bracketSameLine": false,
"arrowParens": "avoid",
"insertPragma": false,
"proseWrap": "preserve",
Expand Down
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[mdx]": {
"editor.defaultFormatter": null,
"editor.formatOnSave": false
Comment on lines +5 to +6
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting defaultFormatter to null should be sufficient according to https://zellwk.com/blog/prettier-disable-languages but it's not. So I disabled as well formatOnSave for MDX according to https://github.com/prettier/prettier-vscode

},
"files.eol": "\n"
}
63 changes: 42 additions & 21 deletions packages/components/cypress/e2e/tabs.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@ describe('tabs', () => {

it('should only show the first tab header as active', () => {
cy.get('@headers').each(($header, index) => {
cy.wrap($header).find('.active').should(index === 0 ? 'exist' : 'not.exist');
cy.wrap($header)
.find('.active')
.should(index === 0 ? 'exist' : 'not.exist');
});
});

it('should only show the tab panel associated with the first tab header', () => {
cy.get('post-tab-panel:visible').as('panel');
cy.get('@panel').should('have.length', 1);
cy.get('@headers').first().invoke('attr', 'panel').then(panel => {
cy.get('@panel').invoke('attr', 'name').should('equal', panel);
});
cy.get('@headers')
.first()
.invoke('attr', 'panel')
.then(panel => {
cy.get('@panel').invoke('attr', 'name').should('equal', panel);
});
});

it('should activate a clicked tab header and deactivate the tab header that was previously activated', () => {
Expand All @@ -42,9 +47,12 @@ describe('tabs', () => {

cy.get('post-tab-panel:visible').as('panel');
cy.get('@panel').should('have.length', 1);
cy.get('@headers').last().invoke('attr', 'panel').then(panel => {
cy.get('@panel').invoke('attr', 'name').should('equal', panel);
});
cy.get('@headers')
.last()
.invoke('attr', 'panel')
.then(panel => {
cy.get('@panel').invoke('attr', 'name').should('equal', panel);
});
});
});

Expand All @@ -57,19 +65,27 @@ describe('tabs', () => {

it('should only show the requested active tab panel', () => {
cy.get('@panel').should('have.length', 1);
cy.get('@tabs').invoke('attr', 'active-panel').then(activePanel => {
cy.get('@panel').invoke('attr', 'name').should('equal', activePanel);
});
cy.get('@tabs')
.invoke('attr', 'active-panel')
.then(activePanel => {
cy.get('@panel').invoke('attr', 'name').should('equal', activePanel);
});
});

it('should show as active only the tab header associated with the requested active tab panel', () => {
cy.get('@tabs').invoke('attr', 'active-panel').then(activePanel => {
cy.get('@headers').each($header => {
cy.wrap($header).invoke('attr', 'panel').then(panel => {
cy.wrap($header).find('.active').should(panel === activePanel ? 'exist' : 'not.exist');
cy.get('@tabs')
.invoke('attr', 'active-panel')
.then(activePanel => {
cy.get('@headers').each($header => {
cy.wrap($header)
.invoke('attr', 'panel')
.then(panel => {
cy.wrap($header)
.find('.active')
.should(panel === activePanel ? 'exist' : 'not.exist');
});
});
});
});
});
});

Expand All @@ -89,9 +105,12 @@ describe('tabs', () => {

cy.get('post-tab-panel:visible').as('panel');
cy.get('@panel').should('have.length', 1);
cy.get('@headers').first().invoke('attr', 'panel').then(panel => {
cy.get('@panel').invoke('attr', 'name').should('equal', panel);
});
cy.get('@headers')
.first()
.invoke('attr', 'panel')
.then(panel => {
cy.get('@panel').invoke('attr', 'name').should('equal', panel);
});
});

it('should activate the newly added tab header after clicking on it', () => {
Expand All @@ -115,9 +134,11 @@ describe('tabs', () => {

cy.get('post-tab-panel:visible').as('panel');
cy.get('@panel').should('have.length', 1);
cy.get('@new-panel').invoke('attr', 'panel').then(panel => {
cy.get('@panel').invoke('attr', 'name').should('equal', panel);
});
cy.get('@new-panel')
.invoke('attr', 'panel')
.then(panel => {
cy.get('@panel').invoke('attr', 'name').should('equal', panel);
});
});

it('should remove a tab header', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ describe('checkPattern', () => {
});

it('should throw the provided error if the value is not a string', () => {
[undefined, null, NaN, 1, true, {}, [], () => {/* empty */}].forEach(notString => {
[
undefined,
null,
NaN,
1,
true,
{},
[],
() => {
/* empty */
},
].forEach(notString => {
expect(runCheckForValue(notString)).toThrow(error);
});
});
Expand Down
Loading