Skip to content

Commit

Permalink
Add support for multiple affiliations (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
duartegalvao authored Mar 15, 2024
1 parent 076f02e commit 5a9dd49
Show file tree
Hide file tree
Showing 20 changed files with 5,811 additions and 17 deletions.
69 changes: 69 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* eslint-disable import/no-commonjs, import/unambiguous */
/* global module:false, __dirname:false */

const path = require('path');
const fs = require('fs');
const {execSync} = require('child_process');
const _ = require('lodash');
const resolve = require('resolve');
const yaml = require('js-yaml');

// Returns the path to the Indico source package/repo
const PATH_COMMAND = `python -c 'from flask.helpers import get_root_path; print(get_root_path("indico"))'`;

let indicoBaseDir = null;
const indicoPathFile = path.join(__dirname, '.indico_source');

// If there's an .indico_source file in the same dir, let's use it
if (fs.existsSync(indicoPathFile)) {
indicoBaseDir = fs
.readFileSync(indicoPathFile)
.toString()
.trim();
}

// Otherwise, let's use Python to figure it out
if (!indicoBaseDir) {
// Figure out where the Indico code base has been set up
indicoBaseDir = path.join(
execSync(PATH_COMMAND, {
encoding: 'utf8',
}).trim(),
'..'
);
}

let currentMap = [];
let defaultConfig = {};

try {
defaultConfig = yaml.safeLoad(fs.readFileSync(path.join(indicoBaseDir, '.eslintrc.yml')));
currentMap = defaultConfig.settings['import/resolver'].alias.map;
} catch (e) {
console.error(e);
}

const reactPath = resolve.sync('react', {basedir: indicoBaseDir});
const react = require(reactPath);
const babelConfigFile = path.join(indicoBaseDir, 'babel.config.js');

module.exports = _.merge(defaultConfig, {
settings: {
'react': {
version: react.version,
},
'import/resolver': {
alias: {
map: currentMap.map(([k, v]) => [k, path.resolve(indicoBaseDir, v)]),
},
node: {
paths: path.join(indicoBaseDir, 'node_modules'),
},
},
},
parserOptions: {
babelOptions: {
configFile: babelConfigFile
}
}
});
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ node_modules/
*.lock
url_map.json
.venv/
webpack-build-config.json
node_modules/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"eslint-config-indico/prettier-config"
85 changes: 85 additions & 0 deletions .stylelintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
extends:
- stylelint-prettier/recommended
- stylelint-config-recommended
- stylelint-config-recommended-scss
- stylelint-stylistic/config

ignoreFiles:
- indico/web/static/dist/**/*.css

rules:
# this rule is too noisy
no-descending-specificity: null

# complains about css rules after `@include` without an empty line
declaration-empty-line-before: null

# `:global()` has special meaning in css modules
selector-pseudo-class-no-unknown:
- true
- ignorePseudoClasses: [global]

selector-pseudo-element-colon-notation: double

font-family-no-missing-generic-family-keyword:
- true
- ignoreFontFamilies: [icomoon-ultimate]

at-rule-empty-line-before:
- always
- except:
- first-nested
ignore:
- blockless-after-same-name-blockless
- after-comment
- inside-block

color-hex-length: short
length-zero-no-unit: true

rule-empty-line-before:
- always
- except: [first-nested]
ignore: [after-comment]

value-keyword-case: lower

scss/at-import-partial-extension: never
scss/at-function-pattern: ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$
scss/at-mixin-argumentless-call-parentheses: always
scss/at-mixin-pattern: ^_?([a-z][a-z0-9]*)(-[a-z0-9]+)*$
scss/at-rule-conditional-no-parentheses: true
scss/dollar-variable-pattern: ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$
scss/percent-placeholder-pattern: ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$
scss/double-slash-comment-whitespace-inside: always
scss/declaration-nested-properties: never
scss/dimension-no-non-numeric-values: true
scss/load-no-partial-leading-underscore: true
scss/media-feature-value-dollar-variable:
- always
- ignore: [keywords]
severity: warning
scss/no-duplicate-dollar-variables:
- true
- ignoreInside: [at-rule, nested-at-rule]
ignoreInsideAtRules: [if, else, function, each]
scss/no-duplicate-mixins: true

# we have "empty" comments in our license header
scss/comment-no-empty: null
# we make heavy use of globals like darken() and lighten()
scss/no-global-function-names: null
# heavily used
scss/at-extend-no-missing-placeholder: null
# prettier's formatting can violate this
scss/operator-no-newline-after: null
# single quotes are clearly superior
stylistic/string-quotes: single

# these rule conflict with stylelint-prettier formatting
stylistic/indentation: null
stylistic/selector-descendant-combinator-no-non-space: null
stylistic/declaration-colon-newline-after: null
stylistic/selector-combinator-space-before: null
stylistic/block-closing-brace-newline-after: null
stylistic/value-list-comma-newline-after: null
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
graft indico_jacow/migrations
graft indico_jacow/static
graft indico_jacow/templates

Expand Down
Loading

0 comments on commit 5a9dd49

Please sign in to comment.