@@ -127,6 +127,7 @@ function ($file) {
127
127
$ this ->_testObsoleteActions ($ content );
128
128
$ this ->_testObsoleteConstants ($ content );
129
129
$ this ->_testObsoletePropertySkipCalculate ($ content );
130
+ $ this ->_testJqueryUiLibraryIsNotUsedInPhp ($ content );
130
131
},
131
132
$ changedFiles
132
133
);
@@ -184,6 +185,11 @@ public function testJsFiles()
184
185
function ($ file ) {
185
186
$ content = file_get_contents ($ file );
186
187
$ this ->_testObsoletePropertySkipCalculate ($ content );
188
+ if (!strpos ($ file , 'requirejs-config.js ' )
189
+ && (strpos ($ file , '/view/frontend/web/ ' ) || strpos ($ file , '/view/base/web/ ' ))
190
+ ) {
191
+ $ this ->_testJqueryUiLibraryIsNotUsedInJs ($ content );
192
+ }
187
193
},
188
194
Files::init ()->getJsFiles ()
189
195
);
@@ -947,4 +953,32 @@ private function getBlacklistFiles($absolutePath = false)
947
953
}
948
954
return $ ignored ;
949
955
}
956
+
957
+ /**
958
+ * Assert that jquery/ui library is not used in JS content.
959
+ *
960
+ * @param string $fileContent
961
+ */
962
+ private function _testJqueryUiLibraryIsNotUsedInJs ($ fileContent )
963
+ {
964
+ $ this ->_assertNotRegexp (
965
+ '/([" \'])jquery\/ui\1/ ' ,
966
+ $ fileContent ,
967
+ $ this ->_suggestReplacement (sprintf ("Dependency '%s' is redundant. " , 'jquery/ui ' ), 'Use separate jquery ui widget instead of all library. ' )
968
+ );
969
+ }
970
+
971
+ /**
972
+ * Assert that jquery/ui library is not used in PHP content.
973
+ *
974
+ * @param string $fileContent
975
+ */
976
+ private function _testJqueryUiLibraryIsNotUsedInPhp ($ fileContent )
977
+ {
978
+ $ this ->_assertNotRegExp (
979
+ '/([" \'])jquery\/ui\1/ ' ,
980
+ $ fileContent ,
981
+ $ this ->_suggestReplacement (sprintf ("Dependency '%s' is redundant. " , 'jquery/ui ' ), 'Use separate jquery ui widget instead of all library. ' )
982
+ );
983
+ }
950
984
}
0 commit comments