Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chore): add lint using CI #2501

Merged
merged 39 commits into from
Dec 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6d1cec4
Unify CS and add CI linter
mvorisek Dec 2, 2022
96c4258
add semi rule
mvorisek Dec 2, 2022
512e134
fix semi indent
mvorisek Dec 2, 2022
3898a44
fix semi with (var|const|let) regex
mvorisek Dec 3, 2022
9eecf41
add no-trailing-spaces rule
mvorisek Dec 3, 2022
5162e9c
manual review/fixes of regex replace
mvorisek Dec 3, 2022
82d922c
add brace-style rule
mvorisek Dec 3, 2022
6db0cf1
manual fixes
mvorisek Dec 3, 2022
c04d00c
add keyword-spacing rule
mvorisek Dec 3, 2022
2c09b16
add space-in-parens rule
mvorisek Dec 3, 2022
3247296
add padded-blocks rule
mvorisek Dec 3, 2022
746e670
add comma-spacing rule
mvorisek Dec 3, 2022
11795f3
add space-before-function-paren rule
mvorisek Dec 3, 2022
fedc0d2
add no-multiple-empty-lines rule
mvorisek Dec 3, 2022
cc5bad2
add space-infix-ops rule
mvorisek Dec 3, 2022
2b3ff7d
add no-multi-spaces rule
mvorisek Dec 3, 2022
c39323b
add padding-line-between-statements rule
mvorisek Dec 3, 2022
817c0fd
add spaced-comment rule /w manual changes
mvorisek Dec 3, 2022
8ec531f
review all comments indent
mvorisek Dec 3, 2022
9d7e49d
semi on a NL for chained & multiline calls
mvorisek Dec 3, 2022
7360cca
semi on a NL for chained & multiline calls II.
mvorisek Dec 3, 2022
bd02237
-1 ident for "$allModules.each"
mvorisek Dec 3, 2022
4fcc8e9
semi on a NL for chained & multiline calls III.
mvorisek Dec 3, 2022
aa0be27
fix multiline operator not indented
mvorisek Dec 3, 2022
b139f75
add quote-props rule
mvorisek Dec 3, 2022
14879ba
add object-curly-spacing rule
mvorisek Dec 3, 2022
bc14eef
add space-before-blocks rule
mvorisek Dec 3, 2022
8173058
add arrow-parens rule
mvorisek Dec 3, 2022
0c8a278
add object-shorthand rule
mvorisek Dec 3, 2022
f4b3da6
add array-bracket-spacing rule
mvorisek Dec 3, 2022
c8e23b9
add dot-notation rule
mvorisek Dec 3, 2022
087cf9b
fix tool import/order and import/no-useless-path-segments rules
mvorisek Dec 3, 2022
7821837
add one-var-declaration-per-line rule
mvorisek Dec 3, 2022
9c1bba5
add function-paren-newline rule
mvorisek Dec 3, 2022
a724525
fix tasks manually
mvorisek Dec 3, 2022
45ebf65
add computed-property-spacing rule
mvorisek Dec 3, 2022
81eefc4
add object-curly-newline rule
mvorisek Dec 3, 2022
aad8a53
add operator-linebreak rule
mvorisek Dec 3, 2022
ef5639d
add comma-style rule
mvorisek Dec 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
module.exports = {
env: {
browser: true,
es6: true,
},
extends: [
],
parserOptions: {
ecmaVersion: '2020',
sourceType: 'module',
},
ignorePatterns: [
'/dist',
'/examples/assets/library',
'/test/coverage',
'/test/helpers',
],
rules: {
indent: ['error', 4, { SwitchCase: 1 }],
'keyword-spacing': ['error'],
'space-in-parens': ['error'],
'comma-spacing': ['error'],
'comma-style': ['error', 'last', {
// https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/rules/style.js#L54
exceptions: {
ArrayExpression: false,
ArrayPattern: false,
ArrowFunctionExpression: false,
CallExpression: false,
FunctionDeclaration: false,
FunctionExpression: false,
ImportDeclaration: false,
ObjectExpression: false,
ObjectPattern: false,
VariableDeclaration: false,
NewExpression: false,
},
}],
'space-before-function-paren': ['error', {
named: 'never',
anonymous: 'always',
asyncArrow: 'always',
}],
'space-infix-ops': ['error'],
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'computed-property-spacing': ['error', 'never'],
'space-before-blocks': ['error'],
'one-var-declaration-per-line': ['error', 'always'],
'function-paren-newline': ['error', 'multiline-arguments'],
'padding-line-between-statements': ['error', {
blankLine: 'always',
prev: '*',
next: ['continue', 'break', 'export', 'return', 'throw'],
}],
'spaced-comment': ['error', 'always', {
line: {
markers: ['/'],
exceptions: ['-', '+'],
},
block: {
markers: ['!'],
exceptions: ['*'],
balanced: true,
},
}],
'padded-blocks': ['error', 'never'],
'no-multiple-empty-lines': ['error', {
max: 1,
maxBOF: 0,
maxEOF: 0,
}],
'no-multi-spaces': ['error', {
exceptions: {
Property: true,
VariableDeclarator: true,
},
}],
'brace-style': ['error'],
curly: ['error'],
'object-shorthand': ['error', 'never'],
'object-curly-newline': ['error', {
// https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/rules/style.js#L395
ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
ImportDeclaration: { minProperties: 4, multiline: true, consistent: true },
ExportDeclaration: { minProperties: 4, multiline: true, consistent: true },
}],
'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
'dot-notation': ['error', { allowKeywords: true }],
'arrow-parens': ['error'],
quotes: ['error', 'single', { avoidEscape: true }],
'quote-props': ['error', 'as-needed', {
keywords: false,
numbers: false,
}],
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
functions: 'never',
imports: 'always-multiline',
exports: 'always-multiline',
}],
semi: ['error'],
'no-extra-semi': ['error'],
'no-trailing-spaces': ['error'],
},
reportUnusedDisableDirectives: true,
};
16 changes: 13 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
name: CI
on: [pull_request]
on: [push, pull_request]
permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Install dependencies
run: yarn
- name: Lint JS files
run: npm run lint
test:
name: Test build process on node ${{ matrix.node-version }}
runs-on: ubuntu-latest
Expand All @@ -13,13 +23,13 @@ jobs:
node-version: [12, 14, 16, 18]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: pre-install
run: sh ./scripts/preinstall.sh
- name: install dependencies
- name: Install dependencies
run: yarn
- name: pre fomantic install & gulp build
run: yarn gulp install
26 changes: 13 additions & 13 deletions examples/assets/show-examples.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
$(document)
.ready(function() {
// add popup to show name
$('.ui:not(.container, .grid)').each(function() {
$(this)
.popup({
on : 'hover',
variation : 'small inverted',
exclusive : true,
content : $(this).attr('class')
})
;
});
})
.ready(function () {
// add popup to show name
$('.ui:not(.container, .grid)').each(function () {
$(this)
.popup({
on: 'hover',
variation: 'small inverted',
exclusive: true,
content: $(this).attr('class'),
})
;
});
})
;
19 changes: 9 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
*******************************/

var
gulp = require('gulp'),
gulp = require('gulp'),

// read user config to know what task to load
config = require('./tasks/config/user')
// read user config to know what task to load
config = require('./tasks/config/user')
;


/*******************************
* Tasks
*******************************/
Expand All @@ -20,21 +19,21 @@ require('./tasks/collections/install')(gulp);

gulp.task('default', gulp.series('check-install'));

/*--------------
/* --------------
Docs
---------------*/
--------------- */

require('./tasks/collections/docs')(gulp);

/*--------------
/* --------------
RTL
---------------*/
--------------- */

if (config.rtl) {
require('./tasks/collections/rtl')(gulp);
require('./tasks/collections/rtl')(gulp);
}

/* Admin Tasks */
if (config.admin) {
require('./tasks/collections/admin')(gulp);
require('./tasks/collections/admin')(gulp);
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
},
"scripts": {
"build": "gulp build",
"changelog": "auto-changelog -p"
"changelog": "auto-changelog -p",
"lint": "eslint -c .eslintrc.js --ext .js .",
"lint-fix": "eslint -c .eslintrc.js --ext .js . --fix"
},
"dependencies": {
"@actions/core": "^1.6.0",
Expand Down Expand Up @@ -73,6 +75,7 @@
"devDependencies": {
"all-contributors-cli": "^6.7.0",
"auto-changelog": "^2.4.0",
"eslint": "^8.28.0",
"node-fetch": "^2.6.0",
"semver": "^7.3.5"
},
Expand Down
Loading