Skip to content

Commit 8e7803b

Browse files
committed
Update to Rhino 1.7.4, JSHint 1.1.0
Rhino 1.7.2 and 1.7.3 fail to parse the JSHint 1.1.0 JavaScript. Include Rhino 1.7.4 from Orbit, update minimal requirement to 1.7.4. Due to the new structure of the jshint library, minifying is not effective anymore, so use the original library. Fixes #40
1 parent 5fba957 commit 8e7803b

File tree

11 files changed

+496
-50
lines changed

11 files changed

+496
-50
lines changed

bundles/com.eclipsesource.jshint/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Bundle-ActivationPolicy: lazy
99
Export-Package: com.eclipsesource.jshint;version="0.9.5",
1010
com.eclipsesource.jshint.internal;version="0.9.5";x-friends:="com.eclipsesource.jshint.test",
1111
com.eclipsesource.json;version="0.9.0"
12-
Require-Bundle: org.mozilla.javascript;bundle-version="1.7.2"
12+
Require-Bundle: org.mozilla.javascript;bundle-version="1.7.4"

bundles/com.eclipsesource.jshint/src/com/eclipsesource/jshint/JSHint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
*/
4646
public class JSHint {
4747

48-
private static final String DEFAULT_JSHINT_VERSION = "r12";
48+
private static final String DEFAULT_JSHINT_VERSION = "1.1.0";
4949
private static final int DEFAULT_JSHINT_INDENT = 4;
5050
private Function jshint;
5151
private Object opts;
@@ -273,7 +273,7 @@ private static int getPropertyAsInt( ScriptableObject object, String name, int d
273273
private static BufferedReader getJsHintReader() throws UnsupportedEncodingException {
274274
ClassLoader classLoader = JSHint.class.getClassLoader();
275275
// Include DEFAULT_JSHINT_VERSION in name to ensure the constant matches the actual version
276-
String name = "com/jshint/jshint-" + DEFAULT_JSHINT_VERSION + ".min.js";
276+
String name = "com/jshint/jshint-" + DEFAULT_JSHINT_VERSION + ".js";
277277
InputStream inputStream = classLoader.getResourceAsStream( name );
278278
return new BufferedReader( new InputStreamReader( inputStream, "UTF-8" ) );
279279
}

bundles/com.eclipsesource.jshint/src/com/eclipsesource/jshint/internal/JSHintRunner.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ private void processFiles() throws IOException {
132132
}
133133

134134
private void configureJSHint() {
135-
jshint.configure( new Configuration() );
135+
Configuration configuration = new Configuration();
136+
configuration.addOption( "undef", true );
137+
jshint.configure( configuration );
136138
}
137139

138140
private String readFileContents( File file ) throws FileNotFoundException, IOException {

bundles/com.eclipsesource.jshint/src/com/jshint/jshint-1.1.0.js

Lines changed: 238 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundles/com.eclipsesource.jshint/src/com/jshint/jshint-r12.min.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

releng/com.eclipsesource.jshint.build/jshint.target

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde version="3.8"?>
33

4-
<target name="Running Platform + Rhino" sequenceNumber="15">
4+
<target name="Running Platform + Rhino" sequenceNumber="21">
55
<locations>
66
<location path="${eclipse_home}" type="Profile"/>
77
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
8-
<unit id="org.mozilla.javascript" version="1.7.2.v201005080400"/>
9-
<unit id="org.mozilla.javascript.source" version="1.7.2.v201005080400"/>
10-
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository/"/>
11-
</location>
12-
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
138
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
149
<unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/>
1510
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository/"/>
1611
</location>
1712
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
13+
<unit id="org.mozilla.javascript" version="1.7.4.v201209142200"/>
14+
<unit id="org.mozilla.javascript.source" version="1.7.4.v201209142200"/>
15+
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20130308121626/repository/"/>
16+
</location>
17+
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
1818
<unit id="org.eclipse.swtbot.forms.feature.group" version="2.0.5.20111003_1754-3676ac8-dev-e36"/>
1919
<unit id="org.eclipse.swtbot.feature.group" version="2.0.5.20111003_1754-3676ac8-dev-e36"/>
2020
<repository location="http://download.eclipse.org/technology/swtbot/helios/dev-build/update-site"/>

releng/com.eclipsesource.jshint.build/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737
<url>http://download.eclipse.org/releases/indigo/</url>
3838
</repository>
3939
<repository>
40-
<id>orbit-repo</id>
40+
<!-- need stable orbit repository, since latest release does not contain rhino 1.7.4 -->
41+
<id>orbit-stable-repo</id>
4142
<layout>p2</layout>
42-
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository/</url>
43+
<url>http://download.eclipse.org/tools/orbit/downloads/drops/S20130308121626/repository/</url>
4344
</repository>
4445
<repository>
4546
<id>swtbot-repo</id>

tests/com.eclipsesource.jshint.test/src/com/eclipsesource/jshint/JSHint_Compatibility_Test.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static Collection<Object[]> getParameters() {
4848
parameters.add( new Object[] { "com/jshint/jshint-r10.js" } );
4949
parameters.add( new Object[] { "com/jshint/jshint-r11.js" } );
5050
parameters.add( new Object[] { "com/jshint/jshint-r12.js" } );
51+
parameters.add( new Object[] { "com/jshint/jshint-1.1.0.js" } );
5152
return parameters;
5253
}
5354

tests/com.eclipsesource.jshint.test/src/com/eclipsesource/jshint/JSHint_Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void setUp() throws IOException {
4444
public void getDefaultVersion() {
4545
String version = JSHint.getDefaultLibraryVersion();
4646

47-
assertTrue( version.matches( "r\\d+" ) );
47+
assertTrue( version.matches( "\\d+\\.\\d+\\.\\d+" ) );
4848
}
4949

5050
@Test( expected = NullPointerException.class )

tests/com.eclipsesource.jshint.test/src/com/eclipsesource/jshint/internal/JSHintRunner_Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void missingFile() throws Exception {
116116
@Test
117117
public void charsetDefaultsToUtf8() throws Exception {
118118
JSHintRunner runner = new JSHintRunner();
119-
File file = createTmpFile( "var föhn = 23;", "UTF-8" );
119+
File file = createTmpFile( "föhn.foo = 23;", "UTF-8" );
120120

121121
runner.run( file.getAbsolutePath() );
122122

@@ -126,7 +126,7 @@ public void charsetDefaultsToUtf8() throws Exception {
126126
@Test
127127
public void customCharset() throws Exception {
128128
JSHintRunner runner = new JSHintRunner();
129-
File file = createTmpFile( "var föhn = 23;", "ISO-8859-1" );
129+
File file = createTmpFile( "föhn.foo = 23;", "ISO-8859-1" );
130130

131131
runner.run( "--charset", "ISO-8859-1", file.getAbsolutePath() );
132132

@@ -136,7 +136,7 @@ public void customCharset() throws Exception {
136136
@Test
137137
public void illegalCharset() throws Exception {
138138
JSHintRunner runner = new JSHintRunner();
139-
File file = createTmpFile( "var föhn = 23;", "ISO-8859-1" );
139+
File file = createTmpFile( "föhn.foo = 23;", "ISO-8859-1" );
140140

141141
runner.run( "--charset", "HMPF!", file.getAbsolutePath() );
142142

0 commit comments

Comments
 (0)