Skip to content

Commit

Permalink
Add .js suffix to .eslintrc
Browse files Browse the repository at this point in the history
This is in preparation for migrating
to the flat format in ESLint 9.
  • Loading branch information
pjonsson committed May 22, 2024
1 parent 5477721 commit e7fdecb
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 58 deletions.
88 changes: 45 additions & 43 deletions .eslintrc → .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,67 @@
{
"root": true,
"extends": [
"use strict";

module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"requireConfigFile": false,
"ecmaVersion": 2019,
"ecmaFeatures": {
"jsx": true,
"modules": true,
"legacyDecorators": true
parser: "@typescript-eslint/parser",
parserOptions: {
requireConfigFile: false,
ecmaVersion: 2019,
ecmaFeatures: {
jsx: true,
modules: true,
legacyDecorators: true
}
},
"env": {
"browser": true,
"commonjs": true,
"es6": true
env: {
browser: true,
commonjs: true,
es6: true
},
"ignorePatterns": ["*.scss.d.ts"],
"plugins": ["react", "react-hooks", "@typescript-eslint"],
"globals": {
"process": true
ignorePatterns: ["*.scss.d.ts"],
plugins: ["react", "react-hooks", "@typescript-eslint"],
globals: {
process: true
},
"settings": {
"react": {
"version": "detect"
settings: {
react: {
version: "detect"
}
},
"rules": {
rules: {
"react-hooks/exhaustive-deps": "error",
"react/jsx-boolean-value": ["error", "never", { "always": [] }],
"react/jsx-boolean-value": ["error", "never", { always: [] }],
"react/no-arrow-function-lifecycle": "error",
"react/no-invalid-html-attribute": "error",
"react/jsx-no-useless-fragment": "error",
"react/jsx-no-constructed-context-values": "error",
"react/jsx-fragments": ["error", "syntax"],
"react/jsx-no-duplicate-props": ["error", { "ignoreCase": true }],
"react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
"react/jsx-pascal-case": [
"error",
{
"allowAllCaps": true,
"ignore": []
allowAllCaps: true,
ignore: []
}
],
"react/no-danger": "warn",
"react/no-did-update-set-state": "error",
"react/no-will-update-set-state": "error",
"react/self-closing-comp": "error",
"react/jsx-no-undef": ["error", { "allowGlobals": true }],
"react/jsx-no-undef": ["error", { allowGlobals: true }],

/*Possible Errors */
"no-console": "off",
"no-inner-declarations": [1, "functions"],

/* Best Practices */
"eqeqeq": ["error"],
eqeqeq: ["error"],
"no-alert": ["error"],
"no-caller": ["error"],
"no-div-regex": ["error"],
Expand All @@ -79,25 +81,25 @@
"no-return-assign": ["error"],
"no-script-url": ["error"],
"no-sequences": ["error"],
"radix": "error",
radix: "error",

/* Strict Mode */
"strict": [0, "global"],
strict: [0, "global"],

/* Variables */
"no-label-var": 1,
"no-unused-vars": [
1,
{
"vars": "local",
"args": "none"
vars: "local",
args: "none"
}
],

"camelcase": [
camelcase: [
0,
{
"properties": "always"
properties: "always"
}
],
"no-array-constructor": "error",
Expand All @@ -107,20 +109,20 @@
/* See https://stackoverflow.com/questions/64646248/eslintrc-js-for-react-17-and-jsx-without-import-react/64646593#64646593 */
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/no-unknown-property": ["error", { "ignore": ["css"] }]
"react/no-unknown-property": ["error", { ignore: ["css"] }]
},
"overrides": [
overrides: [
{
"files": ["**/*.ts", "**/*.tsx"],
"rules": {
files: ["**/*.ts", "**/*.tsx"],
rules: {
// @TODO: revise these rules
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
],
"@typescript-eslint/ban-ts-comment": "warn",
Expand All @@ -131,4 +133,4 @@
}
}
]
}
};
9 changes: 0 additions & 9 deletions buildprocess/.eslintrc

This file was deleted.

11 changes: 11 additions & 0 deletions buildprocess/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use strict";

module.exports = {
env: {
browser: false,
node: true
},
rules: {
"no-sync": 0
}
};
2 changes: 1 addition & 1 deletion doc/contributing/development-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Run any of these tasks with `yarn gulp <task name>` from within the TerriaJS dir
- `build` - Builds a non-minified version of the TerriaJS tests. This task may take 10 seconds or more, which is the main reason for the next task.
- `watch` - Starts the same as `build` but then it stays running and watches for changes to any TerriaJS or Cesium source file that was pulled in to the build. When a change to any of these files is detected, a fast incremental build is automatically kicked off. The incremental build is much faster than the full rebuild because dependencies between source files are cached.
- `release` - The same as `build` except that it also minifies the build tests.
- `lint` - Runs ESLint on the files in the `lib` folder and reports any problems. The ESLint rules are defined in the `.eslintrc` file in the root directory of TerriaJS. A stricter set of rules is also find in the `.eslintrc` file in `lib/ReactViews`.
- `lint` - Runs ESLint on the files in the `lib` folder and reports any problems. The ESLint rules are defined in the `.eslintrc.js` file in the root directory of TerriaJS.
- `docs` - Generates the user guide and reference documentation. The user guide is served at `http://localhost:3002/doc/guide/` and the reference documentation is at `http://localhost:3002/doc/reference/`.
- `make-schema` - Generates [JSON Schema](http://json-schema.org/) for the TerriaJS [Initialization Files](../customizing/initialization-files.md) from the source code. The schema is written to `wwwroot/schema`.
- `test` - Detects browsers available on the local system and launches the test suite in each. The results are reported on the command line.
Expand Down
5 changes: 0 additions & 5 deletions test/.eslintrc

This file was deleted.

7 changes: 7 additions & 0 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use strict";

module.exports = {
env: {
jasmine: true
}
};

0 comments on commit e7fdecb

Please sign in to comment.