Configure ESLint for StandardJS

pull/2/head
Doc Ritezel 7 years ago
parent 27f2d9f9f5
commit 1fb103e60a
  1. 2
      README.md
  2. 3
      assets/.eslintrc
  3. 14
      assets/brunch-config.js
  4. 2
      assets/js/app.js
  5. 10
      assets/js/socket.js
  6. 1268
      assets/package-lock.json
  7. 24
      assets/package.json
  8. 5
      circle.yml

@ -40,6 +40,8 @@ Configure your local CCMenu with the following url: [`https://circleci.com/gh/po
To run the test suite: `$ mix test` To run the test suite: `$ mix test`
To ensure your Elixir code is properly formatted: `$ mix credo --strict` To ensure your Elixir code is properly formatted: `$ mix credo --strict`
To ensure your ES code is properly formatted: `$ cd assets && npm run eslint`
## Contributing ## Contributing

@ -0,0 +1,3 @@
{
"extends": "standard"
}

@ -2,7 +2,7 @@ exports.config = {
// See http://brunch.io/#documentation for docs. // See http://brunch.io/#documentation for docs.
files: { files: {
javascripts: { javascripts: {
joinTo: "js/app.js" joinTo: 'js/app.js'
// To use a separate vendor.js bundle, specify two files path // To use a separate vendor.js bundle, specify two files path
// http://brunch.io/docs/config#-files- // http://brunch.io/docs/config#-files-
@ -21,11 +21,11 @@ exports.config = {
}, },
stylesheets: { stylesheets: {
joinTo: { joinTo: {
"css/app.css": "css/app.scss", 'css/app.css': 'css/app.scss'
} }
}, },
templates: { templates: {
joinTo: "js/app.js" joinTo: 'js/app.js'
} }
}, },
@ -39,9 +39,9 @@ exports.config = {
// Phoenix paths configuration // Phoenix paths configuration
paths: { paths: {
// Dependencies and current project directories to watch // Dependencies and current project directories to watch
watched: ["static", "css", "css/**", "js", "vendor"], watched: ['static', 'css', 'css/**', 'js', 'vendor'],
// Where to compile files to // Where to compile files to
public: "../priv/static" public: '../priv/static'
}, },
// Configure your plugins // Configure your plugins
@ -63,11 +63,11 @@ exports.config = {
modules: { modules: {
autoRequire: { autoRequire: {
"js/app.js": ["js/app"] 'js/app.js': ['js/app']
} }
}, },
npm: { npm: {
enabled: true enabled: true
} }
}; }

@ -11,7 +11,7 @@
// //
// If you no longer want to use a dependency, remember // If you no longer want to use a dependency, remember
// to also remove its path from "config.paths.watched". // to also remove its path from "config.paths.watched".
import "phoenix_html" import 'phoenix_html'
// Import local files // Import local files
// //

@ -3,9 +3,9 @@
// To use Phoenix channels, the first step is to import Socket // To use Phoenix channels, the first step is to import Socket
// and connect at the socket path in "lib/web/endpoint.ex": // and connect at the socket path in "lib/web/endpoint.ex":
import {Socket} from "phoenix" import {Socket} from 'phoenix'
let socket = new Socket("/socket", {params: {token: window.userToken}}) let socket = new Socket('/socket', {params: {token: window.userToken}})
// When you connect, you'll often need to authenticate the client. // When you connect, you'll often need to authenticate the client.
// For example, imagine you have an authentication plug, `MyAuth`, // For example, imagine you have an authentication plug, `MyAuth`,
@ -54,9 +54,9 @@ let socket = new Socket("/socket", {params: {token: window.userToken}})
socket.connect() socket.connect()
// Now that you are connected, you can join channels with a topic: // Now that you are connected, you can join channels with a topic:
let channel = socket.channel("topic:subtopic", {}) let channel = socket.channel('topic:subtopic', {})
channel.join() channel.join()
.receive("ok", resp => { console.log("Joined successfully", resp) }) .receive('ok', resp => { console.log('Joined successfully', resp) })
.receive("error", resp => { console.log("Unable to join", resp) }) .receive('error', resp => { console.log('Unable to join', resp) })
export default socket export default socket

File diff suppressed because it is too large Load Diff

@ -1,9 +1,19 @@
{ {
"repository": {}, "repository": {
"license": "MIT", "type": "git",
"url": "git+https://github.com/poanetwork/poa-explorer.git"
},
"private": true,
"author": "POA Network",
"license": "UNLICENSED",
"engines": {
"node": "8.x",
"npm": "5.x"
},
"scripts": { "scripts": {
"deploy": "brunch build --production", "deploy": "brunch build --production",
"watch": "brunch watch --stdin" "watch": "brunch watch --stdin",
"eslint": "eslint js/**"
}, },
"dependencies": { "dependencies": {
"bootstrap-sass": "^3.3.7", "bootstrap-sass": "^3.3.7",
@ -14,6 +24,14 @@
"babel-brunch": "6.1.1", "babel-brunch": "6.1.1",
"brunch": "2.10.9", "brunch": "2.10.9",
"clean-css-brunch": "2.10.0", "clean-css-brunch": "2.10.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-config-standard-jsx": "^4.0.2",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-standard": "^3.0.1",
"sass-brunch": "github:brunch/sass-brunch#7ffb2e6ebb7380f920a2f594476a3db0654b11b9", "sass-brunch": "github:brunch/sass-brunch#7ffb2e6ebb7380f920a2f594476a3db0654b11b9",
"uglify-js-brunch": "2.10.0" "uglify-js-brunch": "2.10.0"
} }

@ -8,6 +8,7 @@ machine:
- postgresql - postgresql
pre: pre:
- mkdir -p $CIRCLE_TEST_REPORTS/exunit - mkdir -p $CIRCLE_TEST_REPORTS/exunit
- mkdir -p $CIRCLE_TEST_REPORTS/eslint
dependencies: dependencies:
cache_directories: cache_directories:
@ -28,7 +29,9 @@ dependencies:
test: test:
pre: mix credo --strict pre:
- mix credo --strict
- cd assets && npm run eslint -- --format=junit --output-file="$CIRCLE_TEST_REPORTS/eslint/junit.xml" && cd ..
override: override:
- mix test - mix test
post: post:

Loading…
Cancel
Save