Skip to content

Commit

Permalink
Merge pull request #3453 from jugglinmike/docs-from-website
Browse files Browse the repository at this point in the history
[[CHORE]] Verify integration with jshint.com
  • Loading branch information
rwaldron committed Mar 23, 2020
2 parents e2b3972 + 8f1be71 commit b23f046
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -10,3 +10,7 @@ demo.js
.idea

coverage/

# The following directory is created when validating the project website using
# the command `npm run test-website`
tests/jshint.com/
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -30,5 +30,7 @@ matrix:
env: CMD=test-262
- node_js: 10
env: CMD=test-browser
- node_js: 10
env: CMD=test-website
fast_finish: true
sudo: false
23 changes: 13 additions & 10 deletions docs/cli.md
@@ -1,7 +1,7 @@
# Command-line Interface

The JSHint CLI can be installed via npm (see [the Installation page](/install)
for instructions).
The JSHint CLI can be installed via npm (see [the Installation
page](https://jshint.com/install/) for instructions).

Contents: [Specifying Input](#specifying-input) · [Specifying Linting
Options](#specifying-linting-options) · [Special Options](#special-options) ·
Expand Down Expand Up @@ -45,9 +45,9 @@ If a file path is a dash (`-`) then JSHint will read from standard input.

### Specifying Linting Options

The `jshint` executable is capable of applying [linting options](/docs/options)
specified in an external [JSON](http://json.org/)-formatted file. Such a file
might look like this:
The `jshint` executable is capable of applying [linting
options](https://jshint.com/docs/options) specified in an external
[JSON](http://json.org/)-formatted file. Such a file might look like this:

{
"curly": true,
Expand All @@ -71,7 +71,8 @@ If this search yields no results, `jshint` will lint the input code as if no
linting rules had been enabled.

The command-line interface offers some [special options](#special-options) in
addition to [the ones available in other contexts](/docs/options)
addition to [the ones available in other
contexts](https://jshint.com/docs/options)

<a name="special-options"></a>

Expand All @@ -88,7 +89,7 @@ the current file.

For example, you might define a `.jshintrc` file in the top-level directory of
your project (say, `./.jshintrc') to specify the [linting
options](/docs/options) you would like to use in your entire project:
options](https://jshint.com/docs/options) you would like to use in your entire project:

{
"undef": true,
Expand Down Expand Up @@ -116,8 +117,9 @@ Specify options that should only be applied to files matching a given path
pattern.

The following configuration file [disallows variable
shadowing](/docs/options#shadow) for *all* files and [allows expressions as
statements](/docs/options#expr) for only those files ending in `-test.js`:
shadowing](https://jshint.com/docs/options#shadow) for *all* files and [allows
expressions as statements](https://jshint.com/docs/options#expr) for only those
files ending in `-test.js`:

{
"shadow": false,
Expand Down Expand Up @@ -182,7 +184,8 @@ CheckStyle XML.
</file>
</checkstyle>

See also: [Writing your own JSHint reporter](/docs/reporters/).
See also: [Writing your own JSHint
reporter](https://jshint.com/docs/reporters/).

#### `--verbose`

Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -35,6 +35,7 @@
"test-node": "npm run test-unit && npm run test-cli && npm run test-regression",
"test-regression": "nodeunit tests/regression",
"test-unit": "nodeunit tests/unit tests/unit/unstable",
"test-website": "node tests/website.js",
"test": "npm run test-node && npm run test-browser"
},
"main": "./src/jshint.js",
Expand Down
34 changes: 34 additions & 0 deletions tests/website.js
@@ -0,0 +1,34 @@
/**
* The jshint.com project website generates some content based on the state of
* this repository. Changes in this repository could therefore interfere with
* the website. This script verifies that when the website is configured to use
* the current codebase, it builds successfully and passes its own test suite.
*/
"use strict";

var execSync = require("child_process").execSync;
var path = require("path");
var fs = require("fs");

var repository = "https://github.com/jshint/jshint.github.io.git";
var websiteDir = path.join(__dirname, "jshint.com");
var linkName = path.join(websiteDir, "res", "jshint");

function execInSite(command) {
execSync(command, { stdio: "inherit", cwd: websiteDir });
}

fs.mkdirSync(websiteDir, {recursive: true});

execInSite("git init");
execInSite("git pull " + repository + " dev");
execInSite("git rm -rf --ignore-unmatch res/jshint");

try {
fs.unlinkSync(linkName);
} catch (error) {}

fs.symlinkSync(path.join(__dirname, ".."), linkName);

execInSite("npm install");
execInSite("npm test");

0 comments on commit b23f046

Please sign in to comment.