Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#56](https://github.com/green-code-initiative/creedengo-javascript/issues/56) **BREAKING:** Rename plugin to creedengo-javascript
- [#44](https://github.com/green-code-initiative/creedengo-javascript/pull/44) Implement the rule GCI523 for React Native
- [#52](https://github.com/green-code-initiative/creedengo-javascript/pull/52) Remove trailing dots in Sonar rules descriptions
- [#62](https://github.com/green-code-initiative/creedengo-javascript/pull/62) Fix style attribute checks in GCI26 and GCI29
- Update Docker Compose configuration file to V2

### Deleted
Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin/lib/rules/avoid-css-animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
return {
JSXOpeningElement(node) {
const styleAttribute = node.attributes.find(
(attribute) => attribute.name.name === "style",
(attribute) => attribute.name?.name === "style",
);

if (styleAttribute?.value.expression) {
Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin/lib/rules/prefer-shorthand-css-notations.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module.exports = {
return {
JSXOpeningElement(node) {
const styleAttribute = node.attributes.find(
(attr) => attr.name.name === "style",
(attr) => attr.name?.name === "style",
);
if (styleAttribute) {
const nodePropertyNames =
Expand Down
2 changes: 2 additions & 0 deletions eslint-plugin/tests/lib/rules/avoid-css-animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ ruleTester.run("avoid-css-animations", rule, {
`,
`<div style={{ width: '100px', height: '100px' }}>Hello world</div>`,
`<div style="border: 2px solid red">My red element</div>`,
// spread attributes should not throw an error (#49)
"<input {...inputProps} className={styles.input} onChange={handleChange}/>",
],

invalid: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ ruleTester.run("prefer-shorthand-css-notations", rule, {
code: "<div style={{ animationName: 'example', animationDuration: '5s' }}/>",
options: [{ disableProperties: ["animation"] }],
},
// spread attributes should not throw an error (#49)
"<input {...inputProps} className={styles.input} onChange={handleChange}/>",
],
invalid: [
{
Expand Down
Loading