mirror of
https://github.com/primer/css.git
synced 2024-12-23 06:01:54 +03:00
Fixing eslint
This commit is contained in:
parent
e86f9621b8
commit
b503647c42
@ -1,5 +1,8 @@
|
||||
{
|
||||
"extends": [
|
||||
"plugin:jest/recommended"
|
||||
]
|
||||
],
|
||||
"rules": {
|
||||
"eslint-comments/no-use": 0
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,9 @@ describe('./dist/ folder', () => {
|
||||
let distCSS, distMap, distJS
|
||||
|
||||
beforeAll(() => {
|
||||
distCSS = distDir.filter( i => i.match(/\.css$/) )
|
||||
distMap = distDir.filter( i => i.match(/\.map$/) )
|
||||
distJS = distDir.filter( i => i.match(/\.js$/) )
|
||||
distCSS = distDir.filter(i => i.match(/\.css$/))
|
||||
distMap = distDir.filter(i => i.match(/\.map$/))
|
||||
distJS = distDir.filter(i => i.match(/\.js$/))
|
||||
})
|
||||
|
||||
it('is not empty', () => {
|
||||
@ -21,15 +21,15 @@ describe('./dist/ folder', () => {
|
||||
})
|
||||
|
||||
it('contains source maps', () => {
|
||||
distCSS.forEach( file => {
|
||||
for (const file of distCSS) {
|
||||
expect(distMap).toContain(`${file}.map`)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
it('contains stats export files', () => {
|
||||
distCSS.forEach( file => {
|
||||
expect(distJS).toContain(file.replace('.css','.js'))
|
||||
})
|
||||
for (const file of distCSS) {
|
||||
expect(distJS).toContain(file.replace('.css', '.js'))
|
||||
}
|
||||
})
|
||||
|
||||
it('contains stats/ folder', () => {
|
||||
@ -50,8 +50,8 @@ describe('./dist/stats/ folder', () => {
|
||||
})
|
||||
|
||||
it('contains a css file for each stat file', () => {
|
||||
statsDir.forEach( file => {
|
||||
expect(distDir).toContain(file.replace('.json','.css'))
|
||||
})
|
||||
for (const file of statsDir) {
|
||||
expect(distDir).toContain(file.replace('.json', '.css'))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -22,7 +22,7 @@ describe('deprecations', () => {
|
||||
if (deprecations.length) {
|
||||
// Selectors were marked to be deprecated in this version,
|
||||
// but were not removed from the codebase. Please remove these selectors.
|
||||
expect(deprecations.sort()).toEqual(removed.sort())
|
||||
expect(deprecations.sort()).toEqual(removed.sort()) // eslint-disable-line jest/no-conditional-expect
|
||||
}
|
||||
})
|
||||
|
||||
@ -41,7 +41,7 @@ describe('deprecations', () => {
|
||||
if (deprecations.length) {
|
||||
// Variables were marked to be deprecated in this version,
|
||||
// but were not removed from the codebase. Please remove these variables.
|
||||
expect(deprecations.sort()).toEqual(removed.sort())
|
||||
expect(deprecations.sort()).toEqual(removed.sort()) // eslint-disable-line jest/no-conditional-expect
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -9,25 +9,25 @@ beforeAll(async () => {
|
||||
|
||||
describe('frontmatter', () => {
|
||||
it('page title matches link title', () => {
|
||||
navLinks.forEach(link => {
|
||||
for (const link of navLinks) {
|
||||
const content = contentFM[link['url']]
|
||||
expect(content).not.toBeNull()
|
||||
expect(content['title']).toBe(link['title'])
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
it('contains path attribute', () => {
|
||||
Object.values(contentFM).forEach( v => {
|
||||
for (const v of Object.values(contentFM)) {
|
||||
expect(v['path']).not.toBeNull()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('navigation', () => {
|
||||
it('has a file for each nav item', () => {
|
||||
navLinks.forEach(link => {
|
||||
for (const link of navLinks) {
|
||||
const content = contentFM[link['url']]
|
||||
expect(content).not.toBeNull()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
const fs = require('fs')
|
||||
const fs = require('fs')
|
||||
const frontMatter = require('front-matter')
|
||||
const yaml = require('js-yaml')
|
||||
const globby = require('globby')
|
||||
@ -8,15 +8,15 @@ const docsPath = join(__dirname, '../../docs')
|
||||
|
||||
function collectNavLinks(links) {
|
||||
let foundLinks = []
|
||||
links.forEach(link => {
|
||||
for (const link of links) {
|
||||
foundLinks.push({
|
||||
title: link['title'],
|
||||
url: link['url']
|
||||
})
|
||||
if(link['children']) {
|
||||
if (link['children']) {
|
||||
foundLinks = foundLinks.concat(collectNavLinks(link['children']))
|
||||
}
|
||||
})
|
||||
}
|
||||
return foundLinks
|
||||
}
|
||||
|
||||
@ -26,14 +26,14 @@ function getNavigationLinks() {
|
||||
}
|
||||
|
||||
async function getContentFrontmatter() {
|
||||
let fm = {}
|
||||
const fm = {}
|
||||
|
||||
const paths = await globby(join(docsPath, './content/**/*.md*'))
|
||||
paths.forEach(path => {
|
||||
for (const path of paths) {
|
||||
const contents = fs.readFileSync(path, 'utf8')
|
||||
const fmContents = frontMatter(contents)
|
||||
fm[path.replace(join(docsPath, './content'), '').replace(/(\/index)?\.mdx?/,'')] = fmContents['attributes']
|
||||
})
|
||||
fm[path.replace(join(docsPath, './content'), '').replace(/(\/index)?\.mdx?/, '')] = fmContents['attributes']
|
||||
}
|
||||
return fm
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
"fresh": "rm -rf node_modules; npm install",
|
||||
"dist": "script/dist.js",
|
||||
"stylelint": "stylelint --quiet src",
|
||||
"eslint": "eslint deprecations.js lib",
|
||||
"eslint": "eslint deprecations.js __tests__",
|
||||
"prepublishOnly": "script/prepublish",
|
||||
"publish-storybook": "script/publish-storybook",
|
||||
"start": "npm run dev",
|
||||
@ -51,6 +51,7 @@
|
||||
"cssstats": "3.3.0",
|
||||
"eslint": "^7.23.0",
|
||||
"eslint-plugin-github": "^4.1.2",
|
||||
"eslint-plugin-jest": "24.3.2",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-react": "^7.23.1",
|
||||
"filesize": "4.1.2",
|
||||
|
53
yarn.lock
53
yarn.lock
@ -2430,6 +2430,18 @@
|
||||
eslint-scope "^5.0.0"
|
||||
eslint-utils "^2.0.0"
|
||||
|
||||
"@typescript-eslint/experimental-utils@^4.0.1":
|
||||
version "4.20.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.20.0.tgz#a8ab2d7b61924f99042b7d77372996d5f41dc44b"
|
||||
integrity sha512-sQNlf6rjLq2yB5lELl3gOE7OuoA/6IVXJUJ+Vs7emrQMva14CkOwyQwD7CW+TkmOJ4Q/YGmoDLmbfFrpGmbKng==
|
||||
dependencies:
|
||||
"@types/json-schema" "^7.0.3"
|
||||
"@typescript-eslint/scope-manager" "4.20.0"
|
||||
"@typescript-eslint/types" "4.20.0"
|
||||
"@typescript-eslint/typescript-estree" "4.20.0"
|
||||
eslint-scope "^5.0.0"
|
||||
eslint-utils "^2.0.0"
|
||||
|
||||
"@typescript-eslint/parser@>=2.25.0":
|
||||
version "4.19.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.19.0.tgz"
|
||||
@ -2446,10 +2458,23 @@
|
||||
"@typescript-eslint/types" "4.19.0"
|
||||
"@typescript-eslint/visitor-keys" "4.19.0"
|
||||
|
||||
"@typescript-eslint/scope-manager@4.20.0":
|
||||
version "4.20.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.20.0.tgz#953ecbf3b00845ece7be66246608be9d126d05ca"
|
||||
integrity sha512-/zm6WR6iclD5HhGpcwl/GOYDTzrTHmvf8LLLkwKqqPKG6+KZt/CfSgPCiybshmck66M2L5fWSF/MKNuCwtKQSQ==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "4.20.0"
|
||||
"@typescript-eslint/visitor-keys" "4.20.0"
|
||||
|
||||
"@typescript-eslint/types@4.19.0":
|
||||
version "4.19.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.19.0.tgz"
|
||||
|
||||
"@typescript-eslint/types@4.20.0":
|
||||
version "4.20.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.20.0.tgz#c6cf5ef3c9b1c8f699a9bbdafb7a1da1ca781225"
|
||||
integrity sha512-cYY+1PIjei1nk49JAPnH1VEnu7OYdWRdJhYI5wiKOUMhLTG1qsx5cQxCUTuwWCmQoyriadz3Ni8HZmGSofeC+w==
|
||||
|
||||
"@typescript-eslint/typescript-estree@4.19.0":
|
||||
version "4.19.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.19.0.tgz"
|
||||
@ -2462,6 +2487,19 @@
|
||||
semver "^7.3.2"
|
||||
tsutils "^3.17.1"
|
||||
|
||||
"@typescript-eslint/typescript-estree@4.20.0":
|
||||
version "4.20.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.20.0.tgz#8b3b08f85f18a8da5d88f65cb400f013e88ab7be"
|
||||
integrity sha512-Knpp0reOd4ZsyoEJdW8i/sK3mtZ47Ls7ZHvD8WVABNx5Xnn7KhenMTRGegoyMTx6TiXlOVgMz9r0pDgXTEEIHA==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "4.20.0"
|
||||
"@typescript-eslint/visitor-keys" "4.20.0"
|
||||
debug "^4.1.1"
|
||||
globby "^11.0.1"
|
||||
is-glob "^4.0.1"
|
||||
semver "^7.3.2"
|
||||
tsutils "^3.17.1"
|
||||
|
||||
"@typescript-eslint/visitor-keys@4.19.0":
|
||||
version "4.19.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.19.0.tgz"
|
||||
@ -2469,6 +2507,14 @@
|
||||
"@typescript-eslint/types" "4.19.0"
|
||||
eslint-visitor-keys "^2.0.0"
|
||||
|
||||
"@typescript-eslint/visitor-keys@4.20.0":
|
||||
version "4.20.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.20.0.tgz#1e84db034da13f208325e6bfc995c3b75f7dbd62"
|
||||
integrity sha512-NXKRM3oOVQL8yNFDNCZuieRIwZ5UtjNLYtmMx2PacEAGmbaEYtGgVHUHVyZvU/0rYZcizdrWjDo+WBtRPSgq+A==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "4.20.0"
|
||||
eslint-visitor-keys "^2.0.0"
|
||||
|
||||
"@webassemblyjs/ast@1.9.0":
|
||||
version "1.9.0"
|
||||
resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz"
|
||||
@ -5293,6 +5339,13 @@ eslint-plugin-import@>=2.20.1:
|
||||
resolve "^1.17.0"
|
||||
tsconfig-paths "^3.9.0"
|
||||
|
||||
eslint-plugin-jest@24.3.2:
|
||||
version "24.3.2"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.3.2.tgz#30a8b2dea6278d0da1d6fb9d6cd530aaf58050a1"
|
||||
integrity sha512-cicWDr+RvTAOKS3Q/k03+Z3odt3VCiWamNUHWd6QWbVQWcYJyYgUTu8x0mx9GfeDEimawU5kQC+nQ3MFxIM6bw==
|
||||
dependencies:
|
||||
"@typescript-eslint/experimental-utils" "^4.0.1"
|
||||
|
||||
eslint-plugin-jsx-a11y@^6.4.1:
|
||||
version "6.4.1"
|
||||
resolved "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.4.1.tgz"
|
||||
|
Loading…
Reference in New Issue
Block a user