Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

DCOS-13710: Unleash prettier #402

Merged
merged 4 commits into from
May 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .build.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
var srcFolder = './src';
var docsFolder = './docs';
var docsSrc = docsFolder + '/src';
var docsDist = docsFolder + '/dist';
var srcFolder = "./src";
var docsFolder = "./docs";
var docsSrc = docsFolder + "/src";
var docsDist = docsFolder + "/dist";

var dirs = {
srcJS: srcFolder,
srcCSS: srcFolder,
docs: {
src: docsSrc,
dist: docsDist,
srcFonts: docsSrc + '/fonts',
distFonts: docsDist + '/fonts',
srcFonts: docsSrc + "/fonts",
distFonts: docsDist + "/fonts",
srcJS: docsSrc,
distJS: docsDist,
srcCSS: docsFolder + '/styles',
distCSS: docsDist + '/'
srcCSS: docsFolder + "/styles",
distCSS: docsDist + "/"
}
};

var files = {
docs: {
srcJS: dirs.docs.srcJS + '/index.js',
distJS: dirs.docs.distJS + '/index.js',
srcCSS: dirs.docs.srcCSS + '/index.less',
distCSS: dirs.docs.distCSS + '/index.css',
srcFonts: dirs.docs.srcFonts + '/**/*',
srcHTML: dirs.docs.src + '/index.html',
distHTML: dirs.docs.dist + '/index.html'
srcJS: dirs.docs.srcJS + "/index.js",
distJS: dirs.docs.distJS + "/index.js",
srcCSS: dirs.docs.srcCSS + "/index.less",
distCSS: dirs.docs.distCSS + "/index.css",
srcFonts: dirs.docs.srcFonts + "/**/*",
srcHTML: dirs.docs.src + "/index.html",
distHTML: dirs.docs.dist + "/index.html"
}
};

Expand Down
173 changes: 139 additions & 34 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"parser": "babel-eslint",

"ecmaFeatures": {
"jsx": true,
"modules": true
"modules": true,
"sourceType": "module"
},

"env": {
Expand All @@ -13,50 +12,156 @@
"es6": true
},

"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
},

"plugins": [
"react"
"jsx-max-len",
"react",
"compat",
"destructuring"
],

"globals": {
"cy": true,
"Cypress": true,
"context": true,
"xcontext": true,
"xit": true,
"it": true,
"expect": true,
"jest": true,
"ActiveXObject": true,
"Dygraph": true,
"d3": true
},

"extends": [
"dcos"
],

"rules": {
"eqeqeq": [2, "smart"],
"quotes": [2, "single"],
"jsx-quotes": [2, "prefer-double"],
"indent": [2, 2, {"SwitchCase": 1}],
"camelcase": [0, {"properties": "never"}],
"strict": [2, "global"],
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": [2, { "skipBlankLines": false }],
"no-underscore-dangle": 0,
"no-unused-vars": 2,
"no-use-before-define": 0,
// "max-len": [2, 80, 4], TODO: DCOS-914
"no-multiple-empty-lines": [2, {"max": 1}],
"keyword-spacing": [2, {"before": true, "after": true}],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, {
"anonymous": "always", "named": "never"
"prettier/prettier": "error",
"arrow-parens": "off",
"camelcase": ["off", {"properties": "never"}], // This causes errors with mixin properties
"comma-dangle": ["error", "never"],
"compat/compat": "error",
"destructuring/in-params": "off",
"destructuring/no-rename": "off",
"eqeqeq": ["error", "smart"],
"jsx-max-len/jsx-max-len": ["error", {"lineMaxLength": 80, "tabWidth": 2, "maxAttributesPerLine": 1}],
"keyword-spacing": ["error"],
"multiline-ternary": "off", // allow both multiline and single line
"newline-before-return": "error",
"no-mixed-operators": "off",
"no-mixed-spaces-and-tabs": "error",
"no-multiple-empty-lines": ["error", {"max": 1}],
"no-nested-ternary": ["error"],
"no-new": "off",
"no-trailing-spaces": ["error", { "skipBlankLines": false }],
"no-underscore-dangle": "off",
"no-unneeded-ternary": ["error"],
"no-unused-vars": ["error", {
"args": "after-used",
"argsIgnorePattern": "PluginSDK|^_",
"varsIgnorePattern": "^_"
}],
"spaced-comment": [2, "always"],
"valid-jsdoc": [2, {
"no-use-before-define": "off",
"quotes": "off",
"react/jsx-filename-extension": "off",
"semi": ["error"],
"space-before-blocks": ["error", "always"],
"space-before-function-paren": "off",
"spaced-comment": ["error", "always"],
"strict": ["error", "never"], // <-- fix
"valid-jsdoc": ["error", {
"requireReturn": false,
"requireParamDescription": false
}],

// Airbnb overwrites
"array-callback-return": "off",
"arrow-body-style": "off",
"arrow-spacing": "off",
"consistent-return": "off",
"default-case": "off",
"dot-notation": "off",
"func-names": "off",
"global-require": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"jsx-a11y/img-has-alt": "off",
"jsx-a11y/label-has-for": "off",
"key-spacing": "off",
"max-len": "off",
"new-cap": "off",
"newline-per-chained-call": "off",
"no-case-declarations": "off",
"no-console": "off",
"no-else-return": "off",
"no-empty": ["error", { "allowEmptyCatch": true }],
"no-extra-label": "off",
"no-floating-decimal": "off",
"no-inner-declarations": "off",
"no-labels": "off",
"no-new-wrappers": "off",
"no-param-reassign": "off",
"no-restricted-syntax": "off",
"no-return-assign": "off",
"no-shadow": "off",
"no-throw-literal": "off",
"no-undef": "error",
"no-var": "off",
"object-curly-spacing": "off",
"object-property-newline": "off",
"one-var-declaration-per-line": "off",
"one-var": "off",
"operator-assignment": "off",
"padded-blocks": "off",
"prefer-arrow-callback": "off",
"prefer-const": ["error", { "destructuring": "all", "ignoreReadBeforeAssign": false }],
"prefer-rest-params": "off",
"prefer-spread": "off",
"prefer-template": "off",
"quote-props": "off",
"space-in-parens": "off",
"space-infix-ops": "off",
"space-unary-ops": "off",
"vars-on-top": "off",
"wrap-iife": "off",

// React plugin
"react/jsx-no-undef": 2,
"react/jsx-uses-vars": 2,
"react/jsx-sort-props": 0,
"react/jsx-sort-prop-types": [0, {"ignoreCase": true}],
"react/no-did-mount-set-state": 2,
"react/no-did-update-set-state": 2,
"react/no-multi-comp": 2,
"react/prop-types": 0,
"react/react-in-jsx-scope": 2,
"react/self-closing-comp": 2,
"react/wrap-multilines": 2
"react/jsx-boolean-value": "off",
"react/jsx-closing-bracket-location": "off",
"react/jsx-equals-spacing": "off",
"react/jsx-first-prop-new-line": "off",
"react/jsx-no-bind": "off",
"react/jsx-no-target-blank": "off",
"react/jsx-no-undef": "error",
"react/jsx-quotes": "off",
"react/jsx-sort-prop-types": ["off", {"ignoreCase": true}],
"react/jsx-sort-props": "off",
"react/jsx-space-before-closing": "off",
"react/jsx-uses-vars": "error",
"react/no-did-mount-set-state": "error",
"react/no-did-update-set-state": "error",
"react/no-find-dom-node": "off",
"react/no-is-mounted": "off",
"react/no-multi-comp": "error",
"react/no-render-return-value": "off",
"react/no-string-refs": "off",
"react/no-unknown-property": "off",
"react/prefer-es6-class": "off",
"react/prefer-stateless-function": "off",
"react/prop-types": "off", // This causes errors with many
"react/react-in-jsx-scope": "error",
"react/require-extension": "off",
"react/self-closing-comp": "off",
"react/sort-comp": "off"
}
}
45 changes: 20 additions & 25 deletions .webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
var config = require('./.build.config.js');
var glob = require('glob');
var StyleLintPlugin = require('stylelint-webpack-plugin');
var config = require("./.build.config.js");

module.exports = {
devtool: 'source-map',
devtool: "source-map",
entry: config.files.docs.srcJS,
output: {filename: config.files.docs.distJS},
output: { filename: config.files.docs.distJS, publicPath: "" },
module: {
loaders: [{
exclude: /node_modules/,
loader: 'babel-loader',
query: {
cacheDirectory: true
},
test: /\.js$/
}],
postLoaders: [{
loader: 'transform/cacheable?envify'
}]
loaders: [
{
exclude: /node_modules/,
loader: "babel-loader",
query: {
cacheDirectory: true
},
test: /\.js$/
}
],
postLoaders: [
{
loader: "transform/cacheable?envify"
}
]
},
plugins: [
new StyleLintPlugin({
configFile: '.stylelintrc',
files: '**/*.less',
syntax: 'less'
})
],
resolve: {
extensions: ['', '.js']
extensions: ["", ".js"]
},
watch: process.env.NODE_ENV === 'development'
watch: process.env.NODE_ENV === "development"
};
Loading