Skip to content

Commit

Permalink
chore: Use eslint global
Browse files Browse the repository at this point in the history
  • Loading branch information
kosssi committed Sep 20, 2018
1 parent 28d9f83 commit 218f4a4
Show file tree
Hide file tree
Showing 22 changed files with 58 additions and 166 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules
/packages/*/node_modules
/packages/*/coverage
/packages/*/dist
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["./packages/eslint-config-cozy-app/react.js"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "https://github.com/cozy/cozy-libs/issues"
},
"scripts": {
"lint": "lerna run --parallel lint",
"lint": "eslint . --ext js,jsx",
"test": "lerna run --parallel test",
"build": "lerna run --parallel build",
"commitmsg": "commitlint -e $GIT_PARAMS"
Expand Down
28 changes: 18 additions & 10 deletions packages/babel-preset-cozy-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const nodeEnv = {
useBuiltIns: false
}

module.exports = declare((api, options, dirname) => {
module.exports = declare((api, options) => {
// default options
let presetOptions = {
node: false,
Expand All @@ -33,7 +33,9 @@ module.exports = declare((api, options, dirname) => {
for (let option in presetOptions) {
if (options.hasOwnProperty(option)) {
if (typeof options[option] !== 'boolean') {
throw new Error(`Preset cozy-app '${option}' option must be a boolean.`)
throw new Error(
`Preset cozy-app '${option}' option must be a boolean.`
)
}
presetOptions[option] = options[option]
}
Expand Down Expand Up @@ -64,18 +66,24 @@ module.exports = declare((api, options, dirname) => {
// Transform rest properties for object destructuring assignment
// and spread properties for object literals
// useBuiltIns to directly use Object.assign instead of using Babel extends
[require.resolve('babel-plugin-transform-object-rest-spread'), {
useBuiltIns: false
}]
[
require.resolve('babel-plugin-transform-object-rest-spread'),
{
useBuiltIns: false
}
]
]
if (!node && transformRegenerator) {
plugins.push(
// Polyfills generator functions (for async/await usage)
[require.resolve('babel-plugin-transform-runtime'), {
helpers: false,
polyfill: false,
regenerator: true
}]
[
require.resolve('babel-plugin-transform-runtime'),
{
helpers: false,
polyfill: false,
regenerator: true
}
]
)
}
config.plugins = plugins
Expand Down
3 changes: 0 additions & 3 deletions packages/commitlint-config/.eslintrc

This file was deleted.

4 changes: 1 addition & 3 deletions packages/commitlint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
"url": "https://github.com/cozy/cozy-libs/issues"
},
"scripts": {
"test": "jest --env node ./*.spec.js",
"lint": "eslint ./*.js"
"test": "jest --env node ./*.spec.js"
},
"devDependencies": {
"@commitlint/lint": "7.1.2",
"babel-cli": "6.26.0",
"babel-jest": "23.4.2",
"babel-preset-cozy-app": "0.10.1",
"eslint-config-cozy-app": "0.10.0",
"jest": "23.4.2"
},
"dependencies": {
Expand Down
7 changes: 3 additions & 4 deletions packages/cozy-app-publish/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": ["cozy-app"],
"rules": {
"no-console": 0
}
"rules": {
"no-console": 0
}
}
3 changes: 0 additions & 3 deletions packages/cozy-app-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"author": "Cozy",
"license": "MIT",
"scripts": {
"lint": "eslint '{lib, utils,test}/**/*.js'",
"pretest": "yarn lint",
"test": "jest --verbose --coverage",
"test:manual": "jest test/manual.spec.js",
"test:publish": "jest test/publish.spec.js",
Expand All @@ -33,7 +31,6 @@
"lib"
],
"devDependencies": {
"eslint-config-cozy-app": "0.10.0",
"jest": "23.4.2",
"jest-fetch-mock": "1.6.5"
},
Expand Down
3 changes: 0 additions & 3 deletions packages/cozy-device-helper/.eslintrc

This file was deleted.

4 changes: 1 addition & 3 deletions packages/cozy-device-helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"scripts": {
"prepublishOnly": "yarn run build",
"build": "babel src -d dist --ignore *.spec.js",
"test": "jest src/**",
"lint": "eslint src/**"
"test": "jest src/**"
},
"dependencies": {
"lodash": "4.17.10"
Expand All @@ -31,7 +30,6 @@
"babel-jest": "23.0.1",
"babel-preset-cozy-app": "0.10.0",
"babel-preset-env": "1.7.0",
"eslint-config-cozy-app": "0.10.0",
"jest": "23.4.2"
},
"jest": {
Expand Down
5 changes: 4 additions & 1 deletion packages/cozy-release/cozy-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const cliArgs = process.argv.slice(2)

execSh(`sh ${scriptPath} ${cliArgs.join(' ')}`, (err, stderr) => {
if (err) {
if (stderr) console.error(stderr)
if (stderr) {
// eslint-disable-next-line no-console
console.error(stderr)
}
throw new Error(`Exit code: ${err.code}`)
}
})
3 changes: 0 additions & 3 deletions packages/doctypes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
"devDependencies": {
"btoa": "^1.2.1",
"cozy-client-js": "^0.12.0",
"eslint": "^5.0.0",
"eslint-config-cozy-app": "^0.8.0",
"jest": "^23.5.0"
},
"scripts": {
"lint": "eslint src/**",
"test": "jest src/"
}
}
16 changes: 8 additions & 8 deletions packages/eslint-config-cozy-app/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

module.exports = {
plugins: ['prettier'],
extends: [
'eslint:recommended',
'eslint-config-prettier'
],
extends: ['eslint:recommended', 'eslint-config-prettier'],
parser: 'babel-eslint',
env: {
browser: true,
Expand All @@ -14,9 +11,12 @@ module.exports = {
es6: true
},
rules: {
'prettier/prettier': ['error', {
singleQuote: true,
semi: false
}]
'prettier/prettier': [
'error',
{
singleQuote: true,
semi: false
}
]
}
}
4 changes: 1 addition & 3 deletions packages/eslint-config-cozy-app/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const basics = require('./basics')

module.exports = {
plugins: basics.plugins,
extends: basics.extends.concat([
'plugin:react/recommended'
]),
extends: basics.extends.concat(['plugin:react/recommended']),
parser: basics.parser,
parserOptions: { ecmaFeatures: { jsx: true } },
env: basics.env,
Expand Down
4 changes: 1 addition & 3 deletions packages/eslint-config-cozy-app/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const basics = require('./basics')

module.exports = {
plugins: basics.plugins,
extends: basics.extends.concat([
'plugin:vue/recommended'
]),
extends: basics.extends.concat(['plugin:vue/recommended']),
parserOptions: {
parser: 'babel-eslint'
},
Expand Down
3 changes: 0 additions & 3 deletions packages/flags/.eslintrc

This file was deleted.

4 changes: 1 addition & 3 deletions packages/flags/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
"url": "https://github.com/cozy/cozy-libs/issues"
},
"scripts": {
"lint": "eslint src/**",
"build": "babel src -d dist",
"test": "true",
"prepublishOnly": "yarn build"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-preset-cozy-app": "0.10.0",
"eslint-config-cozy-app": "0.10.0"
"babel-preset-cozy-app": "0.10.0"
}
}
3 changes: 0 additions & 3 deletions packages/interapp/.eslintrc

This file was deleted.

4 changes: 1 addition & 3 deletions packages/interapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
},
"scripts": {
"test": "jest",
"build": "babel src -d dist --ignore *.spec.js",
"lint": "eslint src/**"
"build": "babel src -d dist --ignore *.spec.js"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-preset-cozy-app": "^1.1.1",
"eslint-config-cozy-app": "^1.1.1",
"jest": "23.5.0"
}
}
3 changes: 0 additions & 3 deletions packages/realtime/.eslintrc

This file was deleted.

4 changes: 1 addition & 3 deletions packages/realtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
},
"scripts": {
"test": "true",
"lint": "eslint src/**",
"build": "babel src -d dist",
"prepublishOnly": "yarn build",
"watch": "yarn build --watch"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-preset-cozy-app": "0.10.0",
"eslint-config-cozy-app": "0.10.0"
"babel-preset-cozy-app": "0.10.0"
}
}
Loading

0 comments on commit 218f4a4

Please sign in to comment.