Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It can't identify camelCase from Object keys #1

Open
www-YM opened this issue May 22, 2019 · 3 comments
Open

It can't identify camelCase from Object keys #1

www-YM opened this issue May 22, 2019 · 3 comments

Comments

@www-YM
Copy link

www-YM commented May 22, 2019

// counter.js

export default {
  data () {
    return {
      countNum: 0,
      firstName: ''
    }
  },

  methods: {
    increment () {
      const countNum = 2
      this.countNum = countNum
    }
  }
}

// terminal

(master) $ ./node_modules/.bin/eslint ./counter.js 

/Users/rainbo/sites/test/vue-test-utils-getting-started/counter.js
  13:13  error  Variable 'countNum' is not in snake case  more-naming-conventions/snake-case-variables

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

======================
Question:
How can I fix camelCase of Object keys?

@CodingKoopa
Copy link
Owner

CodingKoopa commented May 22, 2019

It's been a while since I've worked with this, and it'll be some time until I'm going to be able to look into this, but the likely place for this to be fixed would be here, as another item in the array.

EDIT: Rereading your issue, I'm actually not sure what the issue is. Are you trying to correct the countNum to count_num? Does --fix not fix that?

@www-YM
Copy link
Author

www-YM commented May 22, 2019

It's been a while since I've worked with this, and it'll be some time until I'm going to be able to look into this, but the likely place for this to be fixed would be here, as another item in the array.

EDIT: Rereading your issue, I'm actually not sure what the issue is. Are you trying to correct the countNum to count_num? Does --fix not fix that?

Thank for your reply.
I'm trying to correct countNum to count_num, and firstName to first_name. But this plugin only fixed countNum.


Wanted:

(master) $ ./node_modules/.bin/eslint ./counter.js 

/Users/rainbo/sites/test/vue-test-utils-getting-started/counter.js
   6:7   error  Identifiers must be snake_case: countNum   snakecasejs/snakecasejs
   7:7   error  Identifiers must be snake_case: firstName  snakecasejs/snakecasejs
  13:13  error  Identifiers must be snake_case: countNum   snakecasejs/snakecasejs
  14:23  error  Identifiers must be snake_case: countNum   snakecasejs/snakecasejs

Actual(eslint-plugin-more-naming-conventions):

(master) $ ./node_modules/.bin/eslint ./counter.js 

/Users/rainbo/sites/test/vue-test-utils-getting-started/counter.js
  13:13  error  Variable 'countNum' is not in snake case  more-naming-conventions/snake-case-variables

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

Solved.
https://www.npmjs.com/package/eslint-plugin-snakecasejs

I found another plugin to solve my problem, thank you for your help.

@CodingKoopa
Copy link
Owner

CodingKoopa commented May 24, 2019

I will be keeping this issue open as this doesn't resolve the issue in this package. Thanks for the info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants