File tree Expand file tree Collapse file tree 1 file changed +30
-12
lines changed Expand file tree Collapse file tree 1 file changed +30
-12
lines changed Original file line number Diff line number Diff line change @@ -15,37 +15,55 @@ description: disallow using deprecated object declaration on data (in Vue.js 3.0
1515This rule reports use of deprecated object declaration on ` data ` property (in Vue.js 3.0.0+).
1616The different from ` vue/no-shared-component-data ` is the root instance being also disallowed.
1717
18- <eslint-code-block fix :rules =" {'vue/no-deprecated-data-object-declaration': ['error']} " >
18+ <eslint-code-block fix :rules =" {'vue/no-deprecated-data-object-declaration': ['error']} " language = " javascript " filename = " example.js " >
1919
20- ``` vue
21- <script>
22- /* ✗ BAD */
20+ ``` js
2321createApp ({
22+ /* ✗ BAD */
2423 data: {
2524 foo: null
2625 }
2726}).mount (' #app' )
27+
28+ createApp ({
29+ /* ✓ GOOD */
30+ data () {
31+ return {
32+ foo: null
33+ }
34+ }
35+ }).mount (' #app' )
36+ ```
37+
38+ </eslint-code-block >
39+
40+ <eslint-code-block fix :rules =" {'vue/no-deprecated-data-object-declaration': ['error']} " >
41+
42+ ``` vue
43+ <script>
2844export default {
45+ /* ✗ BAD */
2946 data: {
3047 foo: null
3148 }
3249}
50+ </script>
51+ ```
3352
34- /* ✓ GOOD */
53+ </eslint-code-block >
54+
55+ <eslint-code-block fix :rules =" {'vue/no-deprecated-data-object-declaration': ['error']} " >
56+
57+ ``` vue
58+ <script>
3559export default {
60+ /* ✓ GOOD */
3661 data () {
3762 return {
3863 foo: null
3964 }
4065 }
4166}
42- createApp({
43- data () {
44- return {
45- foo: null
46- }
47- }
48- }).mount('#app')
4967</script>
5068```
5169
You can’t perform that action at this time.
0 commit comments