Skip to content

Commit

Permalink
refactor(eslint): Inline license header content (#2399)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbchristopher authored May 19, 2021
1 parent 359ee9f commit 90588b3
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 45 deletions.
25 changes: 0 additions & 25 deletions config/license-header.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = {

#### Enforce License Header

If you need to have a consistent license header applied to your files you can include support for by extending `@looker/eslint-config/license-header` and including the content of the license in your repo in `config/license-header.js`
If you need to have a consistent license header applied to your files you can include support for by extending `@looker/eslint-config/license-header`.

## LICENCE

Expand Down
33 changes: 32 additions & 1 deletion packages/eslint-config/license-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,37 @@ module.exports = {
],
plugins: ['header'],
rules: {
'header/header': [2, './config/license-header.js'],
'header/header': [
2,
'block',
[
'',
'',
' MIT License',
'',
' Copyright (c) 2021 Looker Data Sciences, Inc.',
'',
' Permission is hereby granted, free of charge, to any person obtaining a copy',
' of this software and associated documentation files (the "Software"), to deal',
' in the Software without restriction, including without limitation the rights',
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell',
' copies of the Software, and to permit persons to whom the Software is',
' furnished to do so, subject to the following conditions:',
'',
' The above copyright notice and this permission notice shall be included in all',
' copies or substantial portions of the Software.',
'',
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR',
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,',
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE',
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER',
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,',
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE',
' SOFTWARE.',
'',
' ',
],
1,
],
},
}
2 changes: 2 additions & 0 deletions packages/icons/bin/h2x.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/

/* eslint-disable @typescript-eslint/no-var-requires */

/**
* NOTE: This is highly inspired by:
* https://github.com/styled-icons/styled-icons/blob/main/tools/builder/transform
Expand Down
37 changes: 28 additions & 9 deletions packages/icons/bin/prebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,39 @@
* https://github.com/styled-icons/styled-icons/blob/main/tools/builder/generate-icon-package.js
*/

/* eslint-disable @typescript-eslint/no-var-requires */

const path = require('path')
const fg = require('fast-glob')
const fs = require('fs-extra')
const path = require('path')
const h2x = require('./h2x')

const getLicense = () =>
new Promise((resolve, reject) =>
fs.readFile(path.join('../../config/license-header.js'), (err, data) => {
if (err) reject(err)
else resolve(data.toString())
})
)
const license = `/*
MIT License
Copyright (c) 2021 Looker Data Sciences, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
`
const getTemplate = () =>
new Promise((resolve, reject) =>
fs.readFile(path.join('templates', 'icon.tsx.template'), (err, data) => {
Expand Down Expand Up @@ -71,7 +91,6 @@ const generate = async () => {
}

const template = await getTemplate()
const license = await getLicense()

const totalIcons = icons.length

Expand Down
3 changes: 2 additions & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"prebuild": "./bin/prebuild.js"
},
"dependencies": {
"@styled-icons/styled-icon": "^10.6.3"
"@styled-icons/styled-icon": "^10.6.3",
"h2x-types": "^1.1.0"
},
"devDependencies": {
"fast-glob": "^3.2.5",
Expand Down
4 changes: 3 additions & 1 deletion storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"@storybook/addon-a11y": "^6.1.15",
"@storybook/addon-essentials": "^6.1.15",
"@storybook/addon-storyshots": "^6.1.15",
"@storybook/addon-storyshots-puppeteer": "^6.1.15"
"@storybook/addon-storyshots-puppeteer": "^6.1.15",
"babel-loader-exclude-node-modules-except": "^1.1.2",
"tsconfig-paths-webpack-plugin": "^3.5.1"
}
}
8 changes: 5 additions & 3 deletions www/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
*/

/* eslint-disable sort-keys-fix/sort-keys-fix,@typescript-eslint/camelcase */
/* eslint-disable sort-keys-fix/sort-keys-fix, @typescript-eslint/no-var-requires */

const path = require('path')

module.exports = {
pathPrefix: 'components/VERSION',
Expand All @@ -45,13 +47,13 @@ module.exports = {
resolve: `gatsby-source-filesystem`,
options: {
name: `documentation`,
path: `${__dirname}/src/documentation`,
path: path.join(__dirname, '/src/documentation'),
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/documentation`,
path: path.join(__dirname, '/src/documentation'),
},
},
{
Expand Down
2 changes: 2 additions & 0 deletions www/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/

/* eslint-disable @typescript-eslint/no-var-requires */

const path = require('path')
const { createFilePath } = require('gatsby-source-filesystem')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const TableLabel = (label: string, key: number) => {

const SpacingRow = (px: string, rem: string, key: number, label: string) => {
const divStyle = {
background: '#FD5AC9',
background: '#fd5ac9',
height: `${px}px`,
opacity: 0.5,
width: `${px}px`,
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9459,9 +9459,9 @@ ejs@^3.1.2:
jake "^10.6.1"

electron-to-chromium@^1.3.564:
version "1.3.728"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.728.tgz#dbedd6373f595ae10a13d146b66bece4c1afa5bd"
integrity sha512-SHv4ziXruBpb1Nz4aTuqEHBYi/9GNCJMYIJgDEXrp/2V01nFXMNFUTli5Z85f5ivSkioLilQatqBYFB44wNJrA==
version "1.3.731"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.731.tgz#9f17f7e16f798eaddb21409d80aa755b5b5053dc"
integrity sha512-dn1Nyd0DuFa3xhqZJr6/L9phyk+YXJpvrz6Vcu6mFxFqr5TQ9r/F3yvOYFUrEwY4Tbb1YBjN19TDKnSVCQvalA==

electron-to-chromium@^1.3.621:
version "1.3.622"
Expand Down

0 comments on commit 90588b3

Please sign in to comment.