Merge branch 'linters' into 'master'
Linting discussion. See merge request patek-devs/patek.cz!1
This commit is contained in:
commit
3fb47992db
48
.gitlab-ci.yml
Normal file
48
.gitlab-ci.yml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
variables:
|
||||||
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
|
||||||
|
lint:
|
||||||
|
image:
|
||||||
|
name: docker/compose:1.24.1
|
||||||
|
entrypoint:
|
||||||
|
- /bin/sh
|
||||||
|
- "-c"
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
variables:
|
||||||
|
DOCKER_HOST: "tcp://docker:2375/"
|
||||||
|
DOCKER_DRIVER: overlay2
|
||||||
|
script:
|
||||||
|
- docker-compose run xo-js-lint
|
||||||
|
- docker-compose run xo-html-lint
|
||||||
|
- docker-compose run sass-lint
|
||||||
|
build:
|
||||||
|
image:
|
||||||
|
name: klakegg/hugo:0.55.6-ext-alpine
|
||||||
|
entrypoint:
|
||||||
|
- /bin/sh
|
||||||
|
- "-c"
|
||||||
|
script:
|
||||||
|
- hugo --minify
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
expire_in: 3 months
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
|
test:
|
||||||
|
image:
|
||||||
|
name: klakegg/hugo:0.55.6-ext-alpine
|
||||||
|
entrypoint:
|
||||||
|
- /bin/sh
|
||||||
|
- "-c"
|
||||||
|
script:
|
||||||
|
- hugo_output=$(hugo --path-warnings --i18n-warnings)
|
||||||
|
- echo "$hugo_output"
|
||||||
|
- if echo "$hugo_output" | grep -q 'i18n|MISSING_TRANSLATION'; then false; else true; fi
|
||||||
|
- if echo "$hugo_output" | grep -q 'WARN.*Duplicate target paths'; then false; else true; fi
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
expire_in: 1 month
|
13
Makefile
Normal file
13
Makefile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
lint:
|
||||||
|
docker-compose run xo-js-lint
|
||||||
|
docker-compose run xo-html-lint
|
||||||
|
docker-compose run sass-lint
|
||||||
|
|
||||||
|
build:
|
||||||
|
docker-compose run xo-js-lint
|
||||||
|
docker-compose run xo-html-lint
|
||||||
|
docker-compose run sass-lint
|
||||||
|
hugo
|
||||||
|
|
||||||
|
serve:
|
||||||
|
hugo server &
|
23
docker-compose.yml
Normal file
23
docker-compose.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
xo-js-lint:
|
||||||
|
build: linting/js
|
||||||
|
image: patek-devs/xo
|
||||||
|
command: . --env=browser --extend=/eslintrc.yml
|
||||||
|
volumes:
|
||||||
|
- ./themes/patek/assets/js:/src:ro
|
||||||
|
- ./linting/js/eslintrc.yml:/eslintrc.yml:ro
|
||||||
|
xo-html-lint:
|
||||||
|
image: patek-devs/xo
|
||||||
|
command: \*.html --plugin=html --extension=html
|
||||||
|
volumes:
|
||||||
|
- ./:/src:ro
|
||||||
|
sass-lint:
|
||||||
|
build: linting/sass
|
||||||
|
image: patek-devs/sass-lint
|
||||||
|
command: ./**/*.scss --config /sass-lint.yml
|
||||||
|
volumes:
|
||||||
|
- ./themes/patek/assets/css:/src:ro
|
||||||
|
- ./linting/sass/sass-lint.yml:/sass-lint.yml:ro
|
||||||
|
|
22
linting/js/Dockerfile
Normal file
22
linting/js/Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM node:12-alpine
|
||||||
|
|
||||||
|
RUN mkdir /src
|
||||||
|
|
||||||
|
# Hack to upgrade NPM:
|
||||||
|
# - install local version
|
||||||
|
# - replace old global verson with new one
|
||||||
|
|
||||||
|
RUN npm install npm@5.3 && \
|
||||||
|
rm -rf /usr/local/lib/node_modules/npm && \
|
||||||
|
mv /node_modules/npm /usr/local/lib/node_modules
|
||||||
|
|
||||||
|
RUN npm install -g xo@0.24.0
|
||||||
|
|
||||||
|
RUN npm install -g eslint-plugin-html@6.0.0
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
RUN rm -fr /root/.npm /node_modules
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/xo"]
|
6
linting/js/eslintrc.yml
Normal file
6
linting/js/eslintrc.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
rules:
|
||||||
|
quotes:
|
||||||
|
- error
|
||||||
|
- double
|
||||||
|
unicorn/prefer-query-selector: off
|
||||||
|
no-negated-condition: off
|
17
linting/sass/Dockerfile
Normal file
17
linting/sass/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
FROM node:12-alpine
|
||||||
|
|
||||||
|
RUN mkdir /src
|
||||||
|
|
||||||
|
RUN npm install npm@5.3 && \
|
||||||
|
rm -rf /usr/local/lib/node_modules/npm && \
|
||||||
|
mv /node_modules/npm /usr/local/lib/node_modules
|
||||||
|
|
||||||
|
RUN npm install -g sass-lint
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
RUN rm -fr /root/.npm /node_modules
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/sass-lint"]
|
||||||
|
|
3
linting/sass/sass-lint.yml
Normal file
3
linting/sass/sass-lint.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
files:
|
||||||
|
ignore:
|
||||||
|
- 'bulma/**/*.*'
|
Loading…
Reference in New Issue
Block a user