Skip to content

Commit 05378dc

Browse files
committed
Add eslint config and apply linter changes
Signed-off-by: Olga Bulat <obulat@gmail.com>
1 parent 6ea7f8b commit 05378dc

File tree

5 files changed

+70
-34
lines changed

5 files changed

+70
-34
lines changed

.eslintrc.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true
5+
},
6+
'extends': [
7+
'plugin:vue/essential',
8+
'@vue/standard'
9+
],
10+
rules: {
11+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
13+
'indent': ['error', 4],
14+
'space-before-function-paren': ['warn', 'never']
15+
},
16+
parserOptions: {
17+
parser: 'babel-eslint'
18+
},
19+
overrides: [
20+
{
21+
files: [
22+
'**/__tests__/*.{j,t}s?(x)',
23+
'**/tests/unit/**/*.spec.{j,t}s?(x)'
24+
],
25+
env: {
26+
jest: true
27+
}
28+
}
29+
]
30+
}

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"devDependencies": {
3232
"@vue/cli-plugin-babel": "^4.1.0",
3333
"@vue/cli-plugin-e2e-nightwatch": "^4.1.0",
34-
"@vue/cli-plugin-eslint": "^4.1.0",
34+
"@vue/cli-plugin-eslint": "^4.1.1",
3535
"@vue/cli-plugin-unit-jest": "^4.1.0",
3636
"@vue/cli-service": "^4.1.0",
3737
"@vue/eslint-config-standard": "^4.0.0",
@@ -47,5 +47,10 @@
4747
"stylus-loader": "^3.0.2",
4848
"vue-cli-plugin-i18n": "^0.6.0",
4949
"vue-template-compiler": "^2.6.10"
50+
},
51+
"license": "MIT",
52+
"repository": {
53+
"type": "git",
54+
"url": "git+https://github.com/creativecommons/cc-chooser.git"
5055
}
5156
}

src/components/HTMLGenerator.vue

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export default {
124124
components: {
125125
CopyButton,
126126
LicenseIcons,
127+
// eslint-disable-next-line vue/no-unused-components
127128
LicenseIconography
128129
},
129130
data() {

src/components/IconSelector.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default {
4444
case 'nc': return 'You let others copy, distribute, display, perform, use, and modify (but not share a modified work if you have chosen NoDerivatives) your work for any purpose other than commercially, unless they get your permission first.'
4545
case 'nd': return 'You let others copy, distribute, display, perform, use, and modify your work.'
4646
case 'sa': return 'You let others copy, distribute, perform, and modify your work, as long as they distribute any modified work on the same terms. If they want to distribute modified works under other terms, they must get your permission first.'
47-
default: break
47+
default: return null
4848
}
4949
},
5050
heading_disallow() {
@@ -69,7 +69,7 @@ export default {
6969
case 'nd': return "../assets/license-icons/cc-nd-icon.svg"
7070
case 'nc': return "../assets/license-icons/cc-nc-icon.svg"
7171
case 'sa': return "../assets/license-icons/cc-sa-icon.svg"
72-
default: break
72+
default: return null
7373
/* eslint-enable */
7474
}
7575
}

src/components/LicenseIconography.vue

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
This component is a near exact copy of
3-
the LicenseIconography component from
3+
the LicenseIconography component from
44
CC Vocabulary: https://github.com/creativecommons/cc-vocabulary/blob/master/src/elements/LicenseIconography/LicenseIconography.vue
55
-->
66
<!-- eslint-disable -->
@@ -15,64 +15,64 @@
1515
</template>
1616

1717
<script>
18-
import { library } from '@fortawesome/fontawesome-svg-core'
19-
import {
18+
import { library } from '@fortawesome/fontawesome-svg-core'
19+
import {
2020
faCreativeCommons,
2121
faCreativeCommonsBy,
2222
faCreativeCommonsNc,
2323
faCreativeCommonsNd,
2424
faCreativeCommonsSa,
2525
faCreativeCommonsZero
26-
} from '@fortawesome/free-brands-svg-icons/'
27-
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
28-
library.add(
26+
} from '@fortawesome/free-brands-svg-icons/'
27+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
28+
library.add(
2929
faCreativeCommons,
3030
faCreativeCommonsBy,
3131
faCreativeCommonsNc,
3232
faCreativeCommonsNd,
3333
faCreativeCommonsSa,
3434
faCreativeCommonsZero
35-
)
36-
/**
35+
)
36+
/**
3737
* ### License icons are hieroglyphs for the aspects of a license.
3838
*
3939
* A license icon represents an aspect of a license such as shareability and
4040
* commercial usability in pictorial form.
4141
*/
42-
export default {
42+
export default {
4343
name: 'LicenseIconography',
4444
components: {
45-
FontAwesomeIcon
45+
FontAwesomeIcon
4646
},
4747
props: {
48-
/**
48+
/**
4949
* _the list of icons to display_
5050
*
5151
* ⊂ {`''`, `'by'`, `'nc'`, `'nd'`, `'sa'`, `'nc-eu'`, `'nc-jp'`,
5252
* `'sampling'`, `'sampling-plus'`, `'remix'`, `'share'`, `'zero'`,
5353
* `'pd'`}
5454
*/
55-
iconList: {
56-
type: Array,
57-
required: true,
58-
validator: val => val.every(
59-
icon => [
60-
'',
61-
'by',
62-
'nc',
63-
'nd',
64-
'sa',
65-
'zero'
66-
].includes(icon)
67-
)
68-
}
55+
iconList: {
56+
type: Array,
57+
required: true,
58+
validator: val => val.every(
59+
icon => [
60+
'',
61+
'by',
62+
'nc',
63+
'nd',
64+
'sa',
65+
'zero'
66+
].includes(icon)
67+
)
68+
}
6969
},
7070
computed: {
71-
processedIconList: function () {
72-
return this.iconList.map(icon => {
73-
return `creative-commons${icon ? '-' : ''}${icon}`
74-
})
75-
}
71+
processedIconList: function() {
72+
return this.iconList.map(icon => {
73+
return `creative-commons${icon ? '-' : ''}${icon}`
74+
})
75+
}
7676
}
77-
}
77+
}
7878
</script>

0 commit comments

Comments
 (0)