Migrate to ESLint 9 flat config (#239)
* eslint 9 * fix lint errors * update package-lock.json
This commit is contained in:
1 parent
d9d8bbebe1
commit
a4b3068850
9 files changed
+5830
-5854
No files matched your search
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "next/core-web-vitals",
|
|
||||||
"rules": {
|
|
||||||
"semi": [
|
|
||||||
"error",
|
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"space-before-function-paren": "off",
|
|
||||||
"comma-dangle": [
|
|
||||||
"error",
|
|
||||||
"always-multiline"
|
|
||||||
],
|
|
||||||
"quotes": [
|
|
||||||
"warn",
|
|
||||||
"double"
|
|
||||||
],
|
|
||||||
"no-tabs": "error",
|
|
||||||
"indent": [
|
|
||||||
"warn",
|
|
||||||
4
|
|
||||||
],
|
|
||||||
"no-var": "error",
|
|
||||||
"eol-last": ["error", "always"],
|
|
||||||
"react/jsx-uses-react": "error",
|
|
||||||
"react/jsx-uses-vars": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import { dirname } from "path"
|
||||||
|
import { fileURLToPath } from "url"
|
||||||
|
import { FlatCompat } from "@eslint/eslintrc"
|
||||||
|
import { defineConfig, globalIgnores } from "eslint/config"
|
||||||
|
import globals from "globals"
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
|
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores([
|
||||||
|
".next/**",
|
||||||
|
"out/**",
|
||||||
|
"build/**",
|
||||||
|
"modules/**",
|
||||||
|
"public/static/**",
|
||||||
|
"next-env.d.ts",
|
||||||
|
]),
|
||||||
|
...compat.extends("next/core-web-vitals"),
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.browser,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
semi: ["error", "never"],
|
||||||
|
indent: ["warn", 4],
|
||||||
|
quotes: ["warn", "double"],
|
||||||
|
"eol-last": ["error", "always"],
|
||||||
|
"comma-dangle": ["error", "always-multiline"],
|
||||||
|
"no-tabs": "error",
|
||||||
|
"no-var": "error",
|
||||||
|
"space-before-function-paren": "off",
|
||||||
|
"react/jsx-uses-react": "error",
|
||||||
|
"react/jsx-uses-vars": "error",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
Generated
+5756
-5796
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -45,9 +45,10 @@
|
|||||||
"@types/node": "^18.13.0",
|
"@types/node": "^18.13.0",
|
||||||
"@types/react": "^18.0.18",
|
"@types/react": "^18.0.18",
|
||||||
"@types/sharp": "^0.29.2",
|
"@types/sharp": "^0.29.2",
|
||||||
"eslint": "^8.42.0",
|
"eslint": "^9.0.0",
|
||||||
"eslint-config-next": "^15.0.0",
|
"eslint-config-next": "^15.0.0",
|
||||||
"feed": "^4.1.0",
|
"feed": "^4.1.0",
|
||||||
|
"globals": "^16.0.0",
|
||||||
"typescript": "^4.9.0"
|
"typescript": "^4.9.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-12
@@ -1,15 +1,15 @@
|
|||||||
const { Feed } = require('feed')
|
const { Feed } = require("feed")
|
||||||
const axios = require('axios')
|
const axios = require("axios")
|
||||||
const fs = require('fs').promises
|
const fs = require("fs").promises
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: 'https://api.tmshv.com/hudozka',
|
baseURL: "https://api.tmshv.com/hudozka",
|
||||||
})
|
})
|
||||||
|
|
||||||
async function getArticles(limit) {
|
async function getArticles(limit) {
|
||||||
const query = ['post', 'event', 'album']
|
const query = ["post", "event", "album"]
|
||||||
.map(t => `tag=${t}`)
|
.map(t => `tag=${t}`)
|
||||||
.join('&')
|
.join("&")
|
||||||
const url = `/api/pages/tags?${query}&sortBy=-date&skip=0&pageSize=${limit}`
|
const url = `/api/pages/tags?${query}&sortBy=-date&skip=0&pageSize=${limit}`
|
||||||
const res = await api.get(url)
|
const res = await api.get(url)
|
||||||
|
|
||||||
@@ -19,15 +19,15 @@ async function getArticles(limit) {
|
|||||||
(async () => {
|
(async () => {
|
||||||
const articles = await getArticles(30)
|
const articles = await getArticles(30)
|
||||||
|
|
||||||
const url = 'https://art.shlisselburg.org'
|
const url = "https://art.shlisselburg.org"
|
||||||
const feed = new Feed({
|
const feed = new Feed({
|
||||||
title: 'Шлиссельбургская ДХШ',
|
title: "Шлиссельбургская ДХШ",
|
||||||
id: url,
|
id: url,
|
||||||
link: url,
|
link: url,
|
||||||
feedLinks: {
|
feedLinks: {
|
||||||
atom: 'https://art.shlisselburg.org/feed.xml',
|
atom: "https://art.shlisselburg.org/feed.xml",
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
|
||||||
articles.forEach(article => {
|
articles.forEach(article => {
|
||||||
feed.addItem({
|
feed.addItem({
|
||||||
@@ -41,6 +41,6 @@ async function getArticles(limit) {
|
|||||||
|
|
||||||
const content = feed.atom1()
|
const content = feed.atom1()
|
||||||
|
|
||||||
await fs.writeFile('dist/feed.xml', content, { encoding: 'utf-8' })
|
await fs.writeFile("dist/feed.xml", content, { encoding: "utf-8" })
|
||||||
})()
|
})()
|
||||||
|
|
||||||
+14
-14
@@ -1,28 +1,28 @@
|
|||||||
const sitemap = require('sitemap')
|
const sitemap = require("sitemap")
|
||||||
const axios = require('axios')
|
const axios = require("axios")
|
||||||
const fs = require('fs').promises
|
const fs = require("fs").promises
|
||||||
const homeUrl = 'https://art.shlisselburg.org'
|
const homeUrl = "https://art.shlisselburg.org"
|
||||||
const sitemapCacheTime = 600000
|
const sitemapCacheTime = 600000
|
||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: 'https://api.tmshv.com/hudozka',
|
baseURL: "https://api.tmshv.com/hudozka",
|
||||||
})
|
})
|
||||||
|
|
||||||
async function getMenuUrls(frequency = 'daily') {
|
async function getMenuUrls(frequency = "daily") {
|
||||||
const menu = [
|
const menu = [
|
||||||
'/',
|
"/",
|
||||||
'/collective',
|
"/collective",
|
||||||
]
|
]
|
||||||
return menu
|
return menu
|
||||||
// .filter(i => 'url' in i)
|
// .filter(i => 'url' in i)
|
||||||
.map(url => ({
|
.map(url => ({
|
||||||
url,
|
url,
|
||||||
changefreq: frequency
|
changefreq: frequency,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPageUrls(frequency = 'daily') {
|
async function getPageUrls(frequency = "daily") {
|
||||||
const res = await api.get('/api/pages/urls')
|
const res = await api.get("/api/pages/urls")
|
||||||
|
|
||||||
return res.data.items.map(url => ({
|
return res.data.items.map(url => ({
|
||||||
changefreq: frequency,
|
changefreq: frequency,
|
||||||
@@ -40,9 +40,9 @@ async function getPageUrls(frequency = 'daily') {
|
|||||||
let map = sitemap.createSitemap({
|
let map = sitemap.createSitemap({
|
||||||
hostname: homeUrl,
|
hostname: homeUrl,
|
||||||
cacheTime: sitemapCacheTime,
|
cacheTime: sitemapCacheTime,
|
||||||
urls
|
urls,
|
||||||
})
|
})
|
||||||
const content = map.toString()
|
const content = map.toString()
|
||||||
|
|
||||||
await fs.writeFile('dist/sitemap.xml', content, { encoding: 'utf-8' })
|
await fs.writeFile("dist/sitemap.xml", content, { encoding: "utf-8" })
|
||||||
})()
|
})()
|
||||||
@@ -77,7 +77,7 @@ export async function createPageToken(component: StrapiComponent): Promise<Token
|
|||||||
case "hudozka.card-grid": {
|
case "hudozka.card-grid": {
|
||||||
const items = await Promise.all(component.items
|
const items = await Promise.all(component.items
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map(createCardGrid)
|
.map(createCardGrid),
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
token: "grid",
|
token: "grid",
|
||||||
@@ -208,7 +208,7 @@ export async function createCardGrid(card: StrapiPageCard): Promise<PageCardDto>
|
|||||||
|
|
||||||
export async function createHomeCards(data: StrapiHome): Promise<PageCardDto[]> {
|
export async function createHomeCards(data: StrapiHome): Promise<PageCardDto[]> {
|
||||||
const items = await Promise.all(data.cards
|
const items = await Promise.all(data.cards
|
||||||
.map(createCardGrid)
|
.map(createCardGrid),
|
||||||
)
|
)
|
||||||
return items
|
return items
|
||||||
.filter(x => !!x.url)
|
.filter(x => !!x.url)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const Box: React.FC<BoxProps> = ({
|
|||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const newProps = {
|
const newProps = {
|
||||||
className: cx(s.box, className, { vertical, align, center, wrap }),
|
className: cx(className, s.box, { vertical, align, center, wrap }),
|
||||||
style: {
|
style: {
|
||||||
...style,
|
...style,
|
||||||
gap,
|
gap,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const Transition: React.FC<TransitionProps> = props => {
|
|||||||
}, [opacity])
|
}, [opacity])
|
||||||
const transition = useMemo(
|
const transition = useMemo(
|
||||||
() => `all ${props.duration}ms`,
|
() => `all ${props.duration}ms`,
|
||||||
[props.duration]
|
[props.duration],
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in new issue
Block a user