-
-
Notifications
You must be signed in to change notification settings - Fork 59
add no-unused-expressions with do expressions support #131
Conversation
Also wasn't really sure whether this should be behind an option or not. |
d9a6256
to
9b83d5e
Compare
any progress on this? |
06ab74d
to
814fe40
Compare
@donavon thanks for reminding me about this. I went ahead and added an option to turn support for do expressions off and updated the README. If anything is blocking this from being merged please let me know. |
I'm trying to test this PR, but I'm not sure how to set it up. I've fetched the code and then added it to my project by using: My devDependencies:
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-preset-es2015-node": "^6.1.1",
"babel-preset-stage-0": "^6.24.1",
"eslint": "^4.16.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-babel": "file:../../eslint-plugin-babel",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.5.1",
"supertest": "^3.0.0",
"tap-spec": "^4.1.1",
"tape": "^4.8.0"
} I then edited my .eslintrc.js file to add the babel plugin and the no-unused-expressions rule, but when I run eslint I still get the error. My .eslintrc.js file:
module.exports = {
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"babel"
],
"rules": {
"object-curly-spacing": ["warn", "never"],
"func-names": "off",
"space-before-function-paren": ["error", "never"],
"max-len": ["error", 120, 4],
"no-unused-vars": ["error", {"argsIgnorePattern": "next"}],
"import/prefer-default-export": "off",
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"functions": "ignore"
}],
"import/no-extraneous-dependencies": [
"error", {
"devDependencies": true,
"optionalDependencies": false,
"peerDependencies": false,
"packageDir": "./"
}],
"babel/no-unused-expressions": 1
}
}; Any help would be very welcome. |
Ok, so after some validations I'm actually already testing this version of the plugin. Code: level: do {
if (process.env.NODE_ENV === 'testing') {
'error'; // eslint-disable-line
} else if (process.env.NODE_ENV === 'production') {
'info'; // eslint-disable-line
} else {
'debug'; // eslint-disable-line
}
} For each of the comments removed eslint will produce an error:
|
@iSkilled make sure you're using the "eslint": "^3.8.1",
"eslint-config-airbnb": "^12.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-babel": "https://github.com/lyleunderwood/eslint-plugin-babel.git#do-expressions",
"eslint-plugin-flowtype": "^2.21.0",
"eslint-plugin-fp": "^2.3.0",
"eslint-plugin-import": "^2.0.1",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.4.1", "eslintConfig": {
"extends": [
"airbnb",
"plugin:flowtype/recommended"
],
"parser": "babel-eslint",
"plugins": [
"import",
"flowtype",
"babel",
"fp"
],
"env": {
"browser": true
},
"rules": {
"new-cap": [
2,
{
"capIsNewExceptions": [
"Map",
"List"
]
}
],
"no-unused-expressions": 0,
"babel/no-unused-expressions": 2,
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.test.js",
"**/*.test.jsx",
"**/*.stories.js",
"**/*.stories.jsx"
]
}
],
"fp/no-mutation": "error",
"fp/no-arguments": "error",
"fp/no-delete": "error",
"fp/no-let": "error",
"fp/no-loops": "error",
"fp/no-mutating-assign": "error",
"fp/no-mutating-methods": "error"
}
}, |
I updated the following in my .eslintrc.js: "babel/no-unused-expressions": 1 to: "no-unused-expressions": 0,
"babel/no-unused-expressions": 2 and it is now working properly. Thanks! |
any news from maintainers? |
Nothing on my end, just waiting. |
I've been watching this PR for a month now, and no news. Is there a hold up? I'm pretty excited about this getting merged. |
@mackenzie-orange for want of a better option, you can do what I do. My "eslint-plugin-babel": "https://github.com/lyleunderwood/eslint-plugin-babel.git#do-expressions", Of course in this scenario you're sort of beholden to me to not somehow break this repo. If that's a concern then you can just fork it to your own account and reference your own branch. The other problem with this approach is that the branch won't get updates unless manually rebased. |
@lyleunderwood sorry for the delay, but if you're interested, can you update this now that we've moved to using |
814fe40
to
3bfda11
Compare
3bfda11
to
24aa0e1
Compare
@existentialism Done. I rebased on 5.0.0 and implemented in terms of |
@lyleunderwood yeah, accessing options inside |
@lyleunderwood this was released in 5.1.0! thanks again! |
Cool, thanks. |
…o-expressions add no-unused-expressions with do expressions support
/cc #13
I haven't really done any work with babel's AST before, so I'm sure I'm missing a ton of cases.