Skip to content

Commit

Permalink
Set up code style linting with standardjs
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Aug 28, 2019
1 parent 8e2a7de commit a5d6b8a
Show file tree
Hide file tree
Showing 43 changed files with 7,977 additions and 6,988 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
language: node_js
node_js:
- "lts/*"

jobs:
include:
- name: Lint
stage: other
script: npm run lint
node_js: lts/*
18 changes: 13 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ up with ideas and suggestions, and contribute to the code.

There are a few preferences regarding code contributions:

- `jsoneditor` follows the node.js code style as described
[here](http://nodeguide.com/style.html).
- Send pull requests to the `develop` branch, not the `master` branch.
- Only commit changes done in the source files under `./src`, not to the builds
which are located under the `./dist` folder.
- Send pull requests to the `develop` branch, not the `master` branch.
- You can use modern JavaScript features, the code is transpiled using Babel.
- `jsoneditor` follows the https://standardjs.com/ code style. To test:

```
npm run lint
```
- If possible, create a unit test for any new functionality. To run tests:
```
npm test
```
Thanks!
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ with npm (recommended):

<script>
// create the editor
var container = document.getElementById("jsoneditor");
var options = {};
var editor = new JSONEditor(container, options);
var container = document.getElementById("jsoneditor")
var options = {}
var editor = new JSONEditor(container, options)
// set json
var json = {
Expand All @@ -108,11 +108,11 @@ with npm (recommended):
"Number": 123,
"Object": {"a": "b", "c": "d"},
"String": "Hello World"
};
editor.set(json);
}
editor.set(json)
// get json
var json = editor.get();
var json = editor.get()
</script>
</body>
</html>
Expand Down
2 changes: 1 addition & 1 deletion examples/requirejs_demo/requirejs_demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
</style>
<link rel="stylesheet" type="text/css" href="../../dist/jsoneditor.css">
<script data-main="scripts/main" src="scripts/require.js"></script>
<script data-main="scripts/main" src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
</head>
<body>
<p>
Expand Down
32 changes: 16 additions & 16 deletions examples/requirejs_demo/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
var module = '../../../dist/jsoneditor';
var module = '../../../dist/jsoneditor'
require([module], function (JSONEditor) {
// create the editor
var container = document.getElementById('jsoneditor');
var editor = new JSONEditor(container);
var container = document.getElementById('jsoneditor')
var editor = new JSONEditor(container)

// set json
document.getElementById('setJSON').onclick = function () {
var json = {
'array': [1, 2, 3],
'boolean': true,
'null': null,
'number': 123,
'object': {'a': 'b', 'c': 'd'},
'string': 'Hello World'
};
editor.set(json);
};
array: [1, 2, 3],
boolean: true,
null: null,
number: 123,
object: { a: 'b', c: 'd' },
string: 'Hello World'
}
editor.set(json)
}

// get json
document.getElementById('getJSON').onclick = function () {
var json = editor.get();
alert(JSON.stringify(json, null, 2));
};
});
var json = editor.get()
window.alert(JSON.stringify(json, null, 2))
}
})
36 changes: 0 additions & 36 deletions examples/requirejs_demo/scripts/require.js

This file was deleted.

Loading

0 comments on commit a5d6b8a

Please sign in to comment.