diff --git a/CHANGELOG.md b/CHANGELOG.md index 53d4650..4461690 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/eslint-plugin/lib/rules/avoid-css-animations.js b/eslint-plugin/lib/rules/avoid-css-animations.js index 05cb30d..be17afe 100644 --- a/eslint-plugin/lib/rules/avoid-css-animations.js +++ b/eslint-plugin/lib/rules/avoid-css-animations.js @@ -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) { diff --git a/eslint-plugin/lib/rules/prefer-shorthand-css-notations.js b/eslint-plugin/lib/rules/prefer-shorthand-css-notations.js index a1fc288..ee8c7b4 100644 --- a/eslint-plugin/lib/rules/prefer-shorthand-css-notations.js +++ b/eslint-plugin/lib/rules/prefer-shorthand-css-notations.js @@ -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 = diff --git a/eslint-plugin/tests/lib/rules/avoid-css-animations.js b/eslint-plugin/tests/lib/rules/avoid-css-animations.js index 0f19962..eaa008f 100644 --- a/eslint-plugin/tests/lib/rules/avoid-css-animations.js +++ b/eslint-plugin/tests/lib/rules/avoid-css-animations.js @@ -53,6 +53,8 @@ ruleTester.run("avoid-css-animations", rule, { `, `
Hello world
`, `
My red element
`, + // spread attributes should not throw an error (#49) + "", ], invalid: [ diff --git a/eslint-plugin/tests/lib/rules/prefer-shorthand-css-notations.js b/eslint-plugin/tests/lib/rules/prefer-shorthand-css-notations.js index d792380..7559a2c 100644 --- a/eslint-plugin/tests/lib/rules/prefer-shorthand-css-notations.js +++ b/eslint-plugin/tests/lib/rules/prefer-shorthand-css-notations.js @@ -73,6 +73,8 @@ ruleTester.run("prefer-shorthand-css-notations", rule, { code: "
", options: [{ disableProperties: ["animation"] }], }, + // spread attributes should not throw an error (#49) + "", ], invalid: [ {